* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  position: relative;
}

.container {
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: 600px;
  margin-bottom: 60px;
}

h1 {
  text-align: center;
  color: #333;
  margin-bottom: 20px;
}

.info-panel {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 5px;
}

.info-item {
  font-weight: bold;
  color: #555;
}

.controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

button {
  padding: 10px 20px;
  font-size: 16px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  background: #667eea;
  color: white;
  transition: background 0.3s;
}

button:hover {
  background: #5568d3;
}

#game-board {
  display: grid;
  gap: 2px;
  background: #999;
  padding: 2px;
  border-radius: 5px;
  margin: 0 auto;
  width: fit-content;
}

.cell {
  width: var(--cell-size, 40px);
  height: var(--cell-size, 40px);
  background: #ddd;
  border: 2px outset #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
  font-size: calc(var(--cell-size, 40px) * 0.45);
  user-select: none;
}

.cell:hover:not(.revealed):not(.flagged) {
  background: #ccc;
}

.cell.revealed {
  background: #f5f5f5;
  border: 1px solid #999;
  cursor: default;
}

.cell.flagged {
  background: #ffd700;
}

.cell.mine {
  background: #ff4444;
}

.cell.number-1 {
  color: #0000ff;
}
.cell.number-2 {
  color: #008000;
}
.cell.number-3 {
  color: #ff0000;
}
.cell.number-4 {
  color: #000080;
}
.cell.number-5 {
  color: #800000;
}
.cell.number-6 {
  color: #008080;
}
.cell.number-7 {
  color: #000000;
}
.cell.number-8 {
  color: #808080;
}

.hidden-content, button.restart {
  margin: 20px auto 0 auto;
  padding: 10px;
  border-radius: 5px;
  text-align: center;
  display: none;
}

.hidden-content.visible {
  display: block;
}

button.restart.visible {
  display: flex;
  align-items: center;
  justify-content: center
}

.hidden-content h2 {
  color: #2e7d32;
  margin-bottom: 10px;
}

.hidden-content a {
  color: #1565c0;
  font-weight: bold;
  word-break: break-all;
}

.message {
  text-align: center;
  margin-top: 15px;
  font-size: 18px;
  font-weight: bold;
  min-height: 25px;
}

.message.win {
  color: #2e7d32;
}

.message.lose {
  color: #c62828;
}

/* Creator Page Styles */
.creator-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.creator-form label {
  font-weight: bold;
  color: #555;
}

.creator-form select,
.creator-form input[type="text"] {
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 5px;
  width: 100%;
  max-width: 400px; /* Limit width for better readability */
}

.creator-form input[type="url"] {
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 5px;
  width: 100%;
  max-width: 400px; /* Limit width for better readability */
}

.creator-form input[type="url"]#reward-url,
.generated-link-panel input[type="text"]#shareable-link {
  font-size: 11px;
}

.creator-form button {
  width: fit-content;
  align-self: flex-start;
}

.generated-link-panel {
  background: #f0f8ff;
  padding: 15px;
  border-radius: 5px;
  margin-top: 20px;
  border: 1px solid #a7d9ff;
}

.generated-link-panel p {
  margin-bottom: 10px;
  font-weight: bold;
  color: #333;
}

.generated-link-panel input[type="text"] {
  background: #e9f5ff;
  border: 1px solid #87cefa;
  cursor: text;
  margin-bottom: 10px;
}

.generated-link-panel button {
  background: #2196f3;
}

.generated-link-panel button:hover {
  background: #1976d2;
}

/* Footer Styles */

.footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  padding: 10px;
  background: #333;
  color: #fff;
  font-size: 12px;
}

.footer a {
  color: inherit;
  text-decoration: none;
}

.footer a:hover {
  color: inherit;
  text-decoration: none;
}

/* Rules Container Styles */

.rules-container {
  width: 600px; /* Match the max-width of the game container */
  cursor: pointer;
}

.rules-container h3 {
  text-align: center;
  margin-bottom: 0;
}

.rules-container ul {
  display: none;
  margin-top: 15px;
}

.rules-container ul.visible {
  display: block;
}

.rules-container h3::after {
  content: ' ▼';
  font-size: 0.8em;
}

.rules-container.expanded h3::after {
  content: ' ▲';
}

.rules-container li {
  font-size: 0.75em;
  margin-bottom: 5px;
}