body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background: #f4f7fb;
  color: #0f172a;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 64px;
  display: flex;
  flex-direction: column;
}

.top-bar {
  padding: 16px 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0;
}

.page-header {
  padding: 32px 0 16px;
  border-bottom: 1px solid #e2e8f0;
}

.instructions-section {
  padding: 24px 0;
  margin-bottom: 20px;
}

.intro {
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.intro-content {
  flex: 1;
  min-width: 0;
}

.language-switcher {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.lang-btn {
  padding: 8px 16px;
  background: #e2e8f0;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.lang-btn:hover {
  background: #cbd5e1;
}

.lang-btn.active {
  background: var(--accent, #0f766e);
  color: #fff;
  border-color: var(--accent, #0f766e);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.04em;
}

p {
  margin: 0 0 14px;
  max-width: 100%;
  line-height: 1.7;
  font-size: 1rem;
  color: #475569;
}

p:last-child {
  margin-bottom: 0;
}

.instructions-box {
  margin-top: 0;
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
  padding: 18px 20px;
  width: fit-content;
  box-sizing: border-box;
}

.instructions-box[open] {
  width: 100%;
}

.instructions-toggle {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  list-style: none;
}

.instructions-toggle::-webkit-details-marker {
  display: none;
}

.instructions-state {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
}

.instructions-content {
  margin-top: 14px;
}

.instructions-content p:first-of-type {
  margin-bottom: 14px;
}

.rules-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 20px;
}

.rules-list li {
  margin-bottom: 8px;
  color: #475569;
  line-height: 1.6;
}

.rule-badge {
  font-weight: 700;
}

.rule-badge.success {
  color: var(--success, #15803d);
}

.rule-badge.present {
  color: var(--present, #ca8a04);
}

.rule-badge.absent {
  color: var(--absent, #94a3b8);
}

.game-shell {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr minmax(300px, 400px);
  grid-auto-rows: max-content;
  align-items: start;
  align-content: start;
}

.game-panel {
  grid-column: 1;
  order: 1;
  min-width: 200px;
}

.sidebar-panel {
  grid-column: 2;
  grid-row: 1 / -1;
  order: 3;
}

.panel {
  padding: 24px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid #dbe3ee;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

aside.panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: transparent;
  border: none;
  box-shadow: none;
  color: #fff;
  text-align: center;
}

.ad-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  min-height: 400px;
  background-image: linear-gradient(rgba(15, 23, 42, 0.55), rgba(15, 23, 42, 0.55)), url("./images/FF_Ad.jpg");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  border-radius: 20px;
  padding: 24px;
}

.ad-container h3 {
  margin: 0 0 12px;
  font-size: 1.4rem;
  font-weight: 700;
}

.ad-container p {
  margin: 0 0 20px;
  color: rgba(255, 255, 255, 0.9);
  max-width: 100%;
}

.ad-container a,
.linkedin-box a {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.ad-container a {
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.ad-container a:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-2px);
}

.linkedin-box {
  padding: 24px;
  background: linear-gradient(135deg, #0a66c2 0%, #005e96 100%);
  border-radius: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.linkedin-box p {
  margin: 0 0 12px;
  color: #fff;
  font-size: 0.95rem;
}

.linkedin-box a {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 0.9rem;
}

.linkedin-box a:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.page-footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid #dbe3ee;
  text-align: center;
}

.page-footer p {
  margin: 0;
  font-size: 0.9rem;
  color: #64748b;
}

.word-game {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: #0f172a;
}

.word-game * {
  box-sizing: border-box;
}

.word-shell {
  display: flex;
  flex-direction: column;
}

.play-panel,
.keyboard-panel,
.keyboard-grid,
.controls,
.input-row,
.board-shell,
.board {
  display: grid;
}

.play-panel {
  gap: 20px;
  min-width: 0;
}

.keyboard-panel {
  gap: 12px;
}

.keyboard-grid {
  gap: 6px;
}

.keyboard-title {
  margin: 0;
  font-size: 0.95rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.alphabet-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.alpha-key {
  padding: 8px 12px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.alpha-key.correct {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
}

.alpha-key.present {
  background: #ca8a04;
  border-color: #ca8a04;
  color: #fff;
}

.alpha-key.absent {
  background: #94a3b8;
  border-color: #94a3b8;
  color: #fff;
}

.word-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.word-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.word-subtitle {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 500;
}

.word-message {
  margin: 12px 0 0;
  color: #1e293b;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.5;
}

.word-status {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent, #0f766e);
  font-size: 0.8rem;
}

.word-status.won,
.word-status.lost {
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.board-shell {
  gap: 12px;
  padding: 20px;
  border: 1px solid #dbe3ee;
  border-radius: 16px;
  background: #f8fafc;
}

.board {
  gap: 10px;
  width: 100%;
}

.board-row {
  display: grid;
  grid-template-columns: minmax(84px, 108px) 1fr;
  gap: 12px;
  align-items: center;
}

.row-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #475569;
  text-align: left;
}

.row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.board-row.is-new {
  animation: row-reveal 0.35s ease;
}

.tile {
  aspect-ratio: 1;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  font-weight: 800;
  text-transform: none;
  background: #fff;
}

.tile.correct {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
}

.tile.present {
  background: #ca8a04;
  border-color: #ca8a04;
  color: #fff;
}

.tile.absent {
  background: #94a3b8;
  border-color: #94a3b8;
  color: #fff;
}

.tile.pending {
  border-style: dashed;
}

.controls {
  gap: 10px;
  padding: 16px;
  border: 1px solid #dbe3ee;
  border-radius: 16px;
  background: #fff;
  display: grid;
  grid-template-columns: auto 1fr 1fr 1fr;
  align-items: center;
}

.input-row {
  gap: 0;
  width: auto;
  display: flex;
  grid-column: 2 / 5;
  grid-row: 1;
}

.guess-input {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: inherit;
  text-transform: none;
  background: #fff;
  transition: border-color 0.2s;
}

.guess-input:focus {
  outline: none;
  border-color: var(--accent, #0f766e);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.guess-input::placeholder {
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0;
  color: #94a3b8;
  text-transform: none;
}

.button {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  font-size: 0.9rem;
  white-space: nowrap;
}

.button.primary {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  background: var(--accent, #0f766e);
  color: #fff;
}

.button.primary:hover:not(:disabled),
.button.share:hover,
.button.reset:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.button.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button.secondary {
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  background: #e2e8f0;
}

.button.share {
  grid-column: 3;
  grid-row: 2;
  width: 100%;
  background: #16a34a;
  color: #fff;
}

.button.reset {
  grid-column: 4;
  grid-row: 2;
  width: 100%;
  background: #ea580c;
  color: #fff;
}

.congrats-banner {
  background: linear-gradient(135deg, #dcfce7 0%, #e3f1e6 100%);
  border: 2px solid #86efac;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  color: #15803d;
  font-size: 1rem;
  line-height: 1.6;
}

.congrats-banner strong {
  display: block;
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.congrats-banner p {
  margin: 8px 0;
}

.congrats-banner p:last-of-type {
  text-align: center;
}

.congrats-banner a {
  color: #15803d;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid #86efac;
  padding-bottom: 2px;
  transition: all 0.2s;
}

.congrats-banner a:hover {
  border-bottom-color: #15803d;
}

.share-btn {
  display: inline-block;
  margin-top: 12px;
  background: #15803d;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.share-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

@keyframes row-reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .game-shell {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .sidebar-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .game-panel {
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .board-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .controls {
    padding: 16px;
    grid-template-columns: auto 1fr 1fr 1fr;
  }

  .input-row {
    grid-column: 2 / 5;
    grid-row: 1;
  }

  .button.primary {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
  }

  .button.secondary {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
  }

  .button.share {
    grid-column: 3;
    grid-row: 2;
    width: 100%;
  }

  .button.reset {
    grid-column: 4;
    grid-row: 2;
    width: 100%;
  }

  .top-bar {
    padding: 12px 0;
  }

  .page-header {
    padding: 24px 0 12px;
  }

  .instructions-section {
    padding: 16px 0;
    margin-bottom: 24px;
  }
}

@media (max-width: 480px) {
  .page {
    padding: 0 16px 48px;
  }

  .controls {
    grid-template-columns: 60px 1fr 1fr 1fr;
  }

  .button.primary {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
  }

  .input-row {
    grid-column: 2 / 5;
    grid-row: 1;
  }

  .language-switcher {
    gap: 6px;
  }

  .lang-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .page-header {
    padding: 16px 0 10px;
    border-bottom: 1px solid #e2e8f0;
  }

  h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
  }

  .instructions-section {
    padding: 12px 0;
    margin-bottom: 20px;
  }

  .instructions-box {
    padding: 14px 16px;
    border-radius: 12px;
  }

  .instructions-box[open] {
    width: 100%;
    background: #f8fafc;
    padding: 14px 16px;
  }

  .instructions-toggle {
    font-size: 0.95rem;
    gap: 8px;
  }

  .instructions-state {
    font-size: 0.8rem;
  }

  .instructions-content {
    margin-top: 10px;
  }

  .instructions-content p {
    font-size: 0.95rem;
    margin: 0 0 10px;
  }

  .rules-list {
    margin: 10px 0 14px;
    padding: 0;
  }

  .rules-list li {
    margin-bottom: 6px;
    font-size: 0.9rem;
  }

  .panel,
  .linkedin-box,
  .ad-container,
  .board-shell,
  .controls {
    padding: 14px;
  }

  .ad-container {
    min-height: 300px;
  }

  .controls {
    grid-template-columns: auto 1fr 1fr 1fr;
  }

  .input-row {
    grid-column: 2 / 5;
    grid-row: 1;
  }

  .button.primary {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
  }

  .button.secondary {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
  }

  .button.share {
    grid-column: 3;
    grid-row: 2;
    width: 100%;
  }

  .button.reset {
    grid-column: 4;
    grid-row: 2;
    width: 100%;
  }

  .alphabet-row {
    gap: 4px;
  }

  .alpha-key {
    padding: 5px 8px;
    min-height: 32px;
    font-size: 0.9rem;
  }

  .game-shell {
    gap: 16px;
    margin-bottom: 20px;
  }
}
