/* =========================================================================
   Wordle Duel — Airbnb-inspired styling
   Palette: Rausch coral (#FF385C), warm neutrals, soft shadows, big radii.
   ========================================================================= */

:root {
  --rausch: #ff385c;
  --rausch-dark: #e0314f;
  --rausch-soft: #fff0f3;

  --ink: #222222;
  --ink-2: #484848;
  --muted: #717171;
  --line: #dddddd;
  --line-2: #ebebeb;

  --bg: #ffffff;
  --bg-soft: #f7f7f7;
  --bg-warm: #fafafa;

  /* Wordle tiles */
  --green: #2eb872;
  --yellow: #f5b14c;
  --absent: #9aa0a6;
  --tile-empty: #d9dce1;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.16);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.hidden {
  display: none !important;
}

/* =========================== Header =================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(16px, 5vw, 48px);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line-2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--rausch);
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  box-shadow: var(--shadow-sm);
}

.brand-name {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  background: #fff;
}

.chip-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rausch), #ff7a90);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.chip-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.chip-name {
  font-weight: 600;
  font-size: 13px;
}
.chip-stats {
  font-size: 12px;
  color: var(--muted);
}

/* =========================== Layout ================================== */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(16px, 5vw, 48px);
}

.screen {
  animation: fade-in 0.4s ease both;
}
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* =========================== Landing ================================= */
.hero {
  text-align: center;
  padding: clamp(36px, 7vw, 72px) 0 28px;
}

.hero-badge {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--rausch-soft);
  color: var(--rausch-dark);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 22px;
}

.hero-title {
  font-size: clamp(34px, 6.5vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 800;
}
.accent {
  color: var(--rausch);
}

.hero-sub {
  max-width: 560px;
  margin: 18px auto 0;
  font-size: clamp(16px, 2.2vw, 19px);
  color: var(--muted);
}

.lang-card {
  max-width: 440px;
  margin: 34px auto 0;
  padding: 26px;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}

.lang-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 14px;
}

.lang-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.lang-btn .flag {
  font-size: 19px;
}
.lang-btn:not(:disabled):hover {
  border-color: var(--ink);
}
.lang-btn.is-active {
  border-color: var(--rausch);
  background: var(--rausch-soft);
  box-shadow: 0 0 0 1px var(--rausch);
}
.lang-btn.is-soon {
  color: var(--muted);
  cursor: not-allowed;
  background: var(--bg-soft);
}
.lang-btn em {
  margin-left: auto;
  font-style: normal;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.btn-primary {
  width: 100%;
  padding: 15px 22px;
  border-radius: var(--r-md);
  background: var(--rausch);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, transform 0.06s, box-shadow 0.15s;
}
.btn-primary:hover {
  background: var(--rausch-dark);
  box-shadow: var(--shadow-md);
}
.btn-primary:active {
  transform: scale(0.98);
}

.lang-foot {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
}

/* How section */
.how {
  padding: 30px 0 70px;
}
.how h2 {
  text-align: center;
  font-size: clamp(24px, 4vw, 32px);
  letter-spacing: -0.03em;
  margin-bottom: 28px;
}
.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.how-card {
  padding: 24px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--bg-warm);
  transition: transform 0.18s, box-shadow 0.18s;
}
.how-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.how-num {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--rausch);
  color: #fff;
  font-weight: 700;
  margin-bottom: 14px;
}
.how-card h3 {
  font-size: 17px;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.how-card p {
  color: var(--muted);
  font-size: 14.5px;
}
.how-card b.g {
  color: var(--green);
}
.how-card b.y {
  color: var(--yellow);
}

.seo-copy {
  max-width: 760px;
  margin: 54px auto 0;
}
.seo-copy h2 {
  text-align: left;
  margin-bottom: 14px;
}
.seo-copy p {
  color: var(--ink-2);
  margin-bottom: 16px;
  font-size: 16px;
}

/* =========================== Game ==================================== */
.game {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 66px);
  padding: 14px 0 14px;
}

.game-topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.turn-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--rausch-soft);
  color: var(--rausch-dark);
  font-weight: 700;
  font-size: 15px;
  transition: background 0.25s, color 0.25s;
}
.turn-pill.is-bot {
  background: #eef1f4;
  color: var(--ink-2);
}
.turn-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--rausch);
  animation: pulse 1.1s ease-in-out infinite;
}
.turn-pill.is-bot .turn-dot {
  background: var(--absent);
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }
}

/* Timer ring */
.timer {
  position: relative;
  width: 44px;
  height: 44px;
}
.timer-ring {
  transform: rotate(-90deg);
}
.timer-track {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 4;
}
.timer-progress {
  fill: none;
  stroke: var(--rausch);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 119.38;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.timer.warn .timer-progress {
  stroke: #e0314f;
}
.timer-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.timer.warn .timer-num {
  color: var(--rausch-dark);
}

.btn-ghost {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-2);
  background: #fff;
  transition: background 0.15s, border-color 0.15s;
}
.btn-ghost:hover {
  background: var(--bg-soft);
  border-color: var(--ink);
}

/* Skip chips (who has skipped how many turns) */
.skips-bar {
  flex: none;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}
.skip-chip {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--bg-soft);
  padding: 5px 13px;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}
.skip-chip.active {
  background: var(--rausch-soft);
  color: var(--rausch-dark);
  font-weight: 600;
}
.skip-chip.danger {
  background: var(--rausch);
  color: #fff;
  font-weight: 600;
}

/* Single shared Wordle table, vertically scrollable */
.board-wrap {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  padding: 4px 0 10px;
}
.board-single {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  max-width: 380px;
}

/* one line: [left avatar slot] [5 tiles] [right avatar slot] */
.grow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ava-slot {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
}
.grow .row {
  flex: 1 1 auto;
  max-width: 296px;
  min-width: 0;
}

.ava {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 10.5px;
  color: #fff;
  opacity: 0.5;
  transition: opacity 0.25s;
}
.grow.active .ava {
  opacity: 1;
}
.ava.player {
  background: linear-gradient(135deg, var(--rausch), #ff7a90);
}
.ava.bot {
  background: linear-gradient(135deg, #5b6470, #828b97);
  font-size: 15px;
}
/* arrow points at the active row; absolutely placed so it adds no width */
.ava-arrow {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  transition: opacity 0.2s;
}
.ava.player .ava-arrow {
  right: 100%;
  margin-right: 3px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 7px solid var(--rausch);
}
.ava.bot .ava-arrow {
  left: 100%;
  margin-left: 3px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--absent);
}
.grow.active .ava-arrow {
  opacity: 1;
}
.grow.active .ava.player {
  animation: ava-pulse-r 1.3s ease-in-out infinite;
}
.grow.active .ava.bot {
  animation: ava-pulse-g 1.3s ease-in-out infinite;
}
@keyframes ava-pulse-r {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 56, 92, 0.5); }
  50% { box-shadow: 0 0 0 7px rgba(255, 56, 92, 0); }
}
@keyframes ava-pulse-g {
  0%, 100% { box-shadow: 0 0 0 0 rgba(120, 130, 145, 0.5); }
  50% { box-shadow: 0 0 0 7px rgba(120, 130, 145, 0); }
}
/* the whole new active line descends into place after a move */
.grow.anim-in {
  animation: grow-in 0.4s ease;
}
@keyframes grow-in {
  from { transform: translateY(-14px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

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

.tile {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--tile-empty);
  border-radius: 9px;
  font-weight: 700;
  font-size: clamp(18px, 5.2vw, 28px);
  text-transform: uppercase;
  color: var(--ink);
  background: #fff;
  user-select: none;
}
.tile.filled {
  border-color: var(--muted);
  animation: pop 0.12s ease;
}
@keyframes pop {
  0% {
    transform: scale(0.9);
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}
.tile.reveal {
  animation: flip 0.55s ease forwards;
}
@keyframes flip {
  0% {
    transform: rotateX(0);
  }
  50% {
    transform: rotateX(-90deg);
  }
  100% {
    transform: rotateX(0);
  }
}
.tile.g {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.tile.y {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #fff;
}
.tile.x {
  background: var(--absent);
  border-color: var(--absent);
  color: #fff;
}
.row.shake {
  animation: shake 0.5s;
}
@keyframes shake {
  10%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  80% {
    transform: translateX(4px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-7px);
  }
  40%,
  60% {
    transform: translateX(7px);
  }
}

/* Toast */
.toast {
  min-height: 22px;
  text-align: center;
  margin: 6px 0 12px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.2s;
}
.toast.show {
  opacity: 1;
}

/* =========================== Keyboard ================================ */
.keyboard {
  width: 100%;
  max-width: 520px;
  align-self: center;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.2s;
}
.keyboard.locked {
  opacity: 0.45;
  pointer-events: none;
}
.kb-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.key {
  flex: 1;
  min-width: 0;
  height: 56px;
  border-radius: var(--r-sm);
  background: #eceef1;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.05s, background 0.15s, box-shadow 0.1s, color 0.15s;
}
.key:hover {
  background: #e2e5e9;
}
.key:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0.12);
}
.key.wide {
  flex: 1.6;
  font-size: 12.5px;
  background: #d8dce1;
}
.key.g {
  background: var(--green);
  color: #fff;
  box-shadow: 0 2px 0 #239a5b;
}
.key.y {
  background: var(--yellow);
  color: #fff;
  box-shadow: 0 2px 0 #d8973a;
}
.key.x {
  background: var(--absent);
  color: #fff;
  box-shadow: 0 2px 0 #7d838a;
}
.key svg {
  width: 22px;
  height: 22px;
}

/* =========================== Modal =================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  animation: fade-in 0.25s ease both;
}
.modal {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: var(--r-lg);
  padding: 34px 28px 28px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes modal-in {
  from {
    transform: translateY(18px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.modal-emoji {
  font-size: 54px;
  line-height: 1;
  margin-bottom: 10px;
}
.modal-title {
  font-size: 26px;
  letter-spacing: -0.02em;
}
.modal-sub {
  color: var(--muted);
  margin-top: 4px;
}
.modal-word {
  margin: 18px 0;
  font-size: 15px;
  color: var(--ink-2);
}
.modal-word strong {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--rausch-dark);
  font-size: 20px;
}
.modal-stats {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin-bottom: 24px;
}
.modal-stat {
  display: flex;
  flex-direction: column;
}
.modal-stat .v {
  font-size: 24px;
  font-weight: 800;
}
.modal-stat .l {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =========================== Footer ================================= */
.site-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px clamp(16px, 5vw, 48px) 56px;
  border-top: 1px solid var(--line-2);
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.site-footer .foot-brand {
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.site-footer b {
  color: var(--ink-2);
}
.site-footer .foot-small {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--line);
}

/* =========================== Responsive ============================= */
@media (max-width: 560px) {
  .game {
    height: calc(100dvh - 60px);
  }
  .tile {
    border-radius: 7px;
  }
  .key {
    height: 50px;
    font-size: 13px;
  }
  .grow {
    gap: 5px;
  }
  .ava-slot {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
  }
  .ava {
    width: 28px;
    height: 28px;
    font-size: 9.5px;
  }
  .ava.bot {
    font-size: 13px;
  }
}
