/* Wordichi create/sign-in page styles. Split from old main.css. */
/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple-900: #26215C;
  --purple-800: #3C3489;
  --purple-600: #534AB7;
  --purple-400: #7F77DD;
  --purple-100: #CECBF6;
  --purple-50:  #EEEDFE;

  --teal-600: #0F6E56;
  --teal-400: #1D9E75;
  --teal-100: #9FE1CB;

  --amber-600: #BA7517;
  --amber-400: #EF9F27;
  --amber-200: #FAC775;
  --amber-50:  #FAEEDA;

  --coral-600: #993C1D;
  --coral-400: #D85A30;

  --red-400: #E24B4A;
  --green-400: #639922;
  --blue-400: #378ADD;

  --gray-900: #2C2C2A;
  --gray-700: #5F5E5A;
  --gray-400: #888780;
  --gray-200: #D3D1C7;
  --gray-50:  #F1EFE8;

  --bg: #0e0e1a;
  --bg2: #16162a;
  --bg3: #1e1e36;
  --border: rgba(255,255,255,0.08);
  --text: #e8e8f0;
  --text-muted: rgba(255,255,255,0.5);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;

  --font-pixel: 'Press Start 2P', monospace;
  --font-main: 'Nunito', sans-serif;
}

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font-main); }
input, select, textarea { font-family: var(--font-main); }

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background: rgba(14,14,26,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.logo {
  font-family: var(--font-pixel);
  font-size: 1.2rem;
  color: var(--amber-200);
  text-shadow: 2px 2px 0 var(--amber-600);
  white-space: nowrap;
}

.topbar-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  padding-left: 16px;
  align-items: center;
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
  height: max-content;
}
.nav-link:hover,
.nav-link.active { color: var(--text); background: rgba(255,255,255,0.07); }
.nav-link.active { color: var(--amber-200); }
.nav-link-button {
  border: 0;
  background: transparent;
}
.nav-link-button:hover {
  color: var(--text);
  background: rgba(255,255,255,0.07);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coins-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  /*background: rgba(250,199,117,0.12);*/
  /*border: 1px solid rgba(250,199,117,0.3);*/
  /*border-radius: 20px;*/
  padding: 4px 12px;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--amber-200);
}

.lang-select {
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 5px 8px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.lang-select:focus { border-color: var(--purple-400); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(180deg, var(--purple-400) 0%, var(--purple-600) 100%);
  border: 2px solid var(--purple-900);
  border-radius: var(--radius);
  color: white;
  font-weight: 800;
  font-size: 14px;
  padding: 10px 20px;
  transition: all 0.15s;
  box-shadow: 0 4px 0 var(--purple-900);
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--purple-900); }
.btn-primary.btn-large { width: 100%; padding: 14px; font-size: 16px; margin-top: 8px; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  transition: all 0.15s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.2); }

/* ── Pages ───────────────────────────────────────────────────────────────── */
#app { padding: 24px; max-width: 960px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; }

/* ── Auth ────────────────────────────────────────────────────────────────── */
.auth-card {
  max-width: 420px;
  margin: 40px auto;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 14px;
  padding: 8px;
  transition: all 0.15s;
}
.auth-tab.active { background: var(--purple-600); color: white; }

.auth-form h2 {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 20px;
  color: var(--text);
}
.auth-form label { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.auth-form label span { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.auth-form input {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}
.auth-form input:focus { border-color: var(--purple-400); }
.auth-form .btn-primary { width: 100%; margin-top: 8px; }

.auth-error {
  background: rgba(226,75,74,0.12);
  border: 1px solid rgba(226,75,74,0.3);
  border-radius: var(--radius-sm);
  color: #F09595;
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

/* ── Create wordichi ──────────────────────────────────────────────────────────── */
.create-wordichi-card {
  max-width: 600px;
  margin: 0px auto;
  text-align: center;
}
.create-wordichi-card h1 {
  font-family: var(--font-pixel);
  font-size: 1.2rem;
  color: var(--amber-200);
  text-shadow: 2px 2px 0 var(--amber-600);
  margin-bottom: 24px;
}
/*.wordichi-name-input {*/
/*  width: 100%;*/
/*  max-width: 360px;*/
/*  background: rgba(255,255,255,0.06);*/
/*  border: 1px solid var(--border);*/
/*  border-radius: var(--radius);*/
/*  color: var(--text);*/
/*  padding: 12px 16px;*/
/*  font-size: 16px;*/
/*  font-weight: 800;*/
/*  text-align: center;*/
/*  outline: none;*/
/*  margin-bottom: 24px;*/
/*  transition: border-color 0.15s;*/
/*}*/
/*.wordichi-name-input:focus { border-color: var(--amber-200); }*/
.buddy-name-box__input::placeholder {
  opacity: .6;
}

.buddy-name-box__input:-webkit-autofill,
.buddy-name-box__input:-webkit-autofill:hover,
.buddy-name-box__input:-webkit-autofill:focus,
.buddy-name-box__input:-webkit-autofill:active {
  -webkit-text-fill-color: #fff !important;
  caret-color: #fff;
  box-shadow: 0 0 0 1000px rgba(20, 16, 12, 1) inset !important;
  -webkit-box-shadow: 0 0 0 1000px rgba(20, 16, 12, 1) inset !important;
  /*transition: background-color 9999s ease-in-out 0s;*/
  color: #fff;
  border-radius: 26px;
  font-size: 32px !important;
}

.wordichi-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  /*margin-bottom: 24px;*/
}
.wordichi-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  /*min-width: 90px;*/
}
.wordichi-choice:hover { background: var(--bg3); border-color: rgba(255,255,255,0.15); transform: translateY(-2px); }
.wordichi-choice.selected { border-color: var(--amber-200); background: rgba(250,199,117,0.1); }
.wordichi-choice .p-emoji { font-size: 40px; }
.wordichi-choice .p-name { font-family: var(--font-pixel); font-size: 7px; color: var(--text-muted); }

/* ── Home layout ─────────────────────────────────────────────────────────── */
.home-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* ── Device ──────────────────────────────────────────────────────────────── */
.device {
  position: sticky;
  top: 80px;
  width: 240px;
  min-width: 240px;
  background: linear-gradient(180deg, var(--purple-600) 0%, var(--purple-800) 100%);
  border: 3px solid var(--purple-900);
  border-radius: 24px 24px 44px 44px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 0 var(--purple-900), inset 0 2px 0 rgba(255,255,255,0.12);
}

.device-screen {
  width: 210px;
  height: 210px;
  background: #0a1a0a;
  border: 3px solid var(--purple-900);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.6);
}

#bg-canvas { position: absolute; top: 0; left: 0; pointer-events: none; }

.speech-bubble {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.92);
  color: var(--gray-900);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 10;
}
.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(255,255,255,0.92);
}
.speech-bubble.show { opacity: 1; }

.wordichi-sprite {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 4rem;
  cursor: pointer;
  user-select: none;
  animation: idle 1.4s ease-in-out infinite;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
  z-index: 5;
  transition: filter 0.2s;
  text-align: center;
}
.wordichi-sprite:hover { filter: brightness(1.2) drop-shadow(0 3px 10px rgba(255,230,100,0.5)); }

@keyframes idle {
  0%, 100% { bottom: 30px; }
  50% { bottom: 36px; }
}
@keyframes wordichi-happy {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  25% { transform: translateX(-50%) rotate(-20deg); }
  75% { transform: translateX(-50%) rotate(20deg); }
}
@keyframes wordichi-eat {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.2); }
}
@keyframes wordichi-sleep {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.age-badge, .level-badge {
  position: absolute;
  font-family: var(--font-pixel);
  font-size: 7px;
  background: rgba(0,0,0,0.55);
  border-radius: 5px;
  padding: 3px 7px;
  color: rgba(255,255,255,0.75);
}
.age-badge { top: 8px; right: 8px; }
.level-badge { top: 8px; left: 8px; color: var(--amber-200); }

.xp-bar-wrap {
  width: 100%;
  height: 5px;
  background: rgba(0,0,0,0.3);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 2px;
}
.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber-400), var(--amber-200));
  border-radius: 3px;
  width: 0%;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
}

.stats-panel { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.stat-row { display: flex; align-items: center; gap: 6px; }
.stat-icon { font-size: 13px; width: 18px; text-align: center; }
 .stat-bg {
  position: relative;
  flex: 1;
  height: 16px;
  background: rgba(0,0,0,0.35);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.07);
}
.stat-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
}
.stat-val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 2px rgba(0,0,0,0.85), 0 0 5px rgba(0,0,0,0.45);
  pointer-events: none;
  z-index: 2;
}


.energy-regen-wrap {
  position: relative;
  margin: -1px 0 2px 24px;
}
.energy-regen-track {
  height: 5px;
  background: rgba(0,0,0,0.32);
  border-radius: 999px;
  overflow: hidden;
  cursor: help;
}
.energy-regen-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(127,119,221,0.45), rgba(190,185,255,0.95));
  box-shadow: 0 0 10px rgba(127,119,221,0.55);
  transition: width 0.25s linear;
}
.energy-regen-wrap.is-full .energy-regen-fill {
  width: 100%;
  background: linear-gradient(90deg, rgba(34,197,94,0.55), rgba(134,239,172,0.95));
  box-shadow: 0 0 10px rgba(34,197,94,0.45);
}
.energy-regen-wrap::before,
.energy-regen-wrap::after {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 40;
}
.energy-regen-wrap::before {
  content: attr(data-tooltip);
  min-width: max-content;
  max-width: 190px;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.96), rgba(88, 80, 210, 0.94));
  border: 1px solid rgba(213, 210, 255, 0.28);
  box-shadow: 0 12px 28px rgba(0,0,0,0.34), 0 0 18px rgba(127,119,221,0.26);
  color: rgba(255,255,255,0.96);
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1.45;
  text-align: center;
  white-space: normal;
}
.energy-regen-wrap::after {
  content: '';
  bottom: calc(100% + 4px);
  width: 10px;
  height: 10px;
  background: rgba(68, 60, 176, 0.96);
  border-right: 1px solid rgba(213, 210, 255, 0.22);
  border-bottom: 1px solid rgba(213, 210, 255, 0.22);
  transform: translate(-50%, 6px) rotate(45deg);
}
.energy-regen-wrap:hover::before,
.energy-regen-wrap:hover::after,
.energy-regen-wrap:focus-visible::before,
.energy-regen-wrap:focus-visible::after {
  opacity: 1;
}
.energy-regen-wrap:hover::before,
.energy-regen-wrap:focus-visible::before {
  transform: translate(-50%, 0);
}
.energy-regen-wrap:hover::after,
.energy-regen-wrap:focus-visible::after {
  transform: translate(-50%, 0) rotate(45deg);
}

.actions-grid {
  position: relative;
  z-index: 99;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}
.action-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: white;
  transition: all 0.12s;
}
.action-btn:hover { background: rgba(255,255,255,0.15); transform: translateY(-1px); }
.action-btn:active { transform: translateY(1px); }
.action-btn .a-icon { font-size: 18px; }
.action-btn .a-label { font-family: var(--font-pixel); font-size: 6px; color: rgba(255,255,255,0.75); }
.action-btn .a-cost { font-size: 8px; color: var(--amber-200); }
.action-btn .a-effects {
  justify-content: center;
  max-width: 100%;
  margin-top: 1px;
}
.action-btn .effect-pill {
  padding: 2px 4px;
  border-radius: 999px;
  font-size: 8px;
}
.action-btn .effect-pill b {
  font-size: 8px;
  min-width: auto;
}
.action-btn .effect-pill em {
  font-size: 8px;
}

.effect-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.effect-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.07);
  line-height: 1;
  white-space: nowrap;
}
.effect-pill b {
  font-style: normal;
  font-weight: 900;
  font-size: 10px;
  min-width: 10px;
  text-align: center;
}
.effect-pill em {
  font-style: normal;
  font-weight: 900;
  font-size: 10px;
}
.effect-pill-good {
  color: rgba(214,255,235,0.96);
  background: rgba(29,158,117,0.13);
  border-color: rgba(159,225,203,0.24);
}
.effect-pill-bad {
  color: rgba(255,214,214,0.96);
  background: rgba(226,75,74,0.12);
  border-color: rgba(226,75,74,0.24);
}

.earn-btn {
  width: 100%;
  background: linear-gradient(180deg, var(--amber-200) 0%, var(--amber-400) 100%);
  border: 2px solid var(--amber-600);
  border-radius: var(--radius);
  font-family: var(--font-pixel);
  font-size: 9px;
  color: #412402;
  padding: 11px;
  box-shadow: 0 4px 0 var(--amber-600);
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.earn-btn:hover { filter: brightness(1.05); }
.earn-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--amber-600); }

/* ── Right panel ─────────────────────────────────────────────────────────── */
.right-panel { flex: 1; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.panel-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-title {
  font-family: var(--font-pixel);
  font-size: 1.1rem;
  color: var(--amber-200);
}

.coins-badge span:first-child {
  transform: translateY(-3px);
  font-size: 15px;
}

.wordichi-info-header { display: flex; align-items: center; gap: 14px; }
.wordichi-big-emoji { font-size: 48px; filter: drop-shadow(0 3px 8px rgba(0,0,0,0.4)); }
.wordichi-name-display { font-size: 22px; font-weight: 900; color: var(--text); }
.wordichi-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Shop ────────────────────────────────────────────────────────────────── */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.shop-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.15s;
  cursor: pointer;
}
.shop-card:hover { background: var(--bg3); border-color: rgba(250,199,117,0.3); transform: translateY(-2px); }
.shop-card:active { transform: translateY(0); }
.shop-card.cant-afford { opacity: 0.45; cursor: not-allowed; }
.sc-emoji { font-size: 36px; }
.sc-info { flex: 1; }
.sc-name { font-weight: 900; font-size: 15px; }
.sc-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.sc-effects { margin-top: 7px; }
.sc-effects .effect-pill { padding: 4px 7px; }
.sc-price {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--amber-200);
  background: rgba(250,199,117,0.1);
  border: 1px solid rgba(250,199,117,0.25);
  border-radius: 8px;
  padding: 6px 10px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg3);
  border: 1px solid rgba(250,199,117,0.35);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--amber-200);
  line-height: 1.8;
  z-index: 999;
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.3s;
  pointer-events: none;
  max-width: 260px;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Particles ───────────────────────────────────────────────────────────── */
.particle {
  position: absolute;
  pointer-events: none;
  animation: pfloat 1.2s ease-out forwards;
  font-size: 20px;
  z-index: 20;
}
@keyframes pfloat {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-70px) scale(1.6); }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .home-layout { flex-direction: column; align-items: center; }
  .device { width: 100%; max-width: 300px; position: static;}
  .right-panel { width: 100%; }
  .topbar-nav { display: none; }
  #app { padding: 16px; }
}


/* ── Wordichi page shop + level guide ───────────────────────────────────────── */
.xp-bar-wrap { position: relative; height: 14px; }
.xp-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: 6px;
  color: rgba(255,255,255,0.78);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  pointer-events: none;
}
.shop-panel { border-color: rgba(250,199,117,0.18); }
.shop-grid-compact { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.shop-grid-compact .shop-card { padding: 12px; border-radius: var(--radius); }
.shop-grid-compact .sc-emoji { font-size: 30px; }
.shop-grid-compact .sc-name { font-size: 14px; }
.shop-grid-compact .sc-price { font-size: 8px; padding: 5px 8px; }
.level-guide { background: linear-gradient(180deg, rgba(250,199,117,0.08), rgba(127,119,221,0.06)); }
.guide-list { display: grid; gap: 8px; color: var(--text-muted); font-size: 13px; }
.guide-list div {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
}
@media (max-width: 680px) {
  .shop-grid-compact { grid-template-columns: 1fr; }
}


/* ── Level up popup ─────────────────────────────────────────────────────── */
.levelup-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(circle at 50% 35%, rgba(250,199,117,0.24), rgba(11,15,30,0.78) 42%, rgba(6,8,16,0.9));
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.levelup-modal.show { opacity: 1; pointer-events: auto; }
.levelup-card {
  position: relative;
  width: min(420px, 100%);
  overflow: hidden;
  text-align: center;
  padding: 28px 24px 22px;
  border-radius: 28px;
  border: 1px solid rgba(250,199,117,0.45);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.13), rgba(255,255,255,0.04)),
    linear-gradient(135deg, rgba(127,119,221,0.95), rgba(31,41,82,0.98) 46%, rgba(15,24,44,0.98));
  box-shadow: 0 30px 90px rgba(0,0,0,0.5), 0 0 45px rgba(250,199,117,0.2);
  transform: translateY(14px) scale(0.96);
  transition: transform 0.24s cubic-bezier(.2,1.2,.2,1);
}
.levelup-modal.show .levelup-card { transform: translateY(0) scale(1); }
.levelup-card > *:not(.levelup-confetti) { position: relative; z-index: 1; }
.levelup-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}
.levelup-confetti-piece {
  position: absolute;
  top: -22px;
  font-size: 18px;
  animation: levelup-confetti-fall 1.15s cubic-bezier(.15,.75,.2,1) forwards;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.28));
}
.levelup-burst {
  font-family: var(--font-pixel);
  font-size: 10px;
  letter-spacing: 8px;
  color: var(--amber-200);
  text-shadow: 0 0 18px rgba(250,199,117,0.75);
  animation: levelup-pop 0.8s ease both;
}
.levelup-wordichi-icon {
  width: 90px;
  height: 90px;
  display: grid;
  place-items: center;
  margin: 12px auto 10px;
  font-size: 54px;
  border-radius: 28px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 18px 42px rgba(0,0,0,0.25);
  animation: levelup-wordichi-bounce 1.1s ease infinite;
}
.levelup-card h2 {
  margin: 0;
  font-family: var(--font-pixel);
  font-size: 18px;
  line-height: 1.5;
  color: #fff7d6;
  text-shadow: 0 0 20px rgba(250,199,117,0.55);
}
.levelup-card p {
  margin: 8px 0 16px;
  color: rgba(255,255,255,0.78);
  font-weight: 800;
}
.levelup-benefits {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}
.levelup-benefit {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 11px 12px;
  border-radius: 16px;
  color: rgba(255,255,255,0.9);
  font-weight: 900;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.14);
}
.levelup-benefit-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(250,199,117,0.16);
  flex: 0 0 auto;
}
.levelup-close {
  width: 100%;
  min-height: 46px;
}
@keyframes levelup-pop {
  0% { transform: translateY(8px) scale(0.8); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes levelup-confetti-fall {
  0% { transform: translate3d(0, -18px, 0) rotate(0deg) scale(0.7); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translate3d(var(--x), 260px, 0) rotate(var(--r)) scale(1); opacity: 0; }
}
@keyframes levelup-wordichi-bounce {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-7px) rotate(2deg); }
}
@media (max-width: 480px) {
  .levelup-card { padding: 24px 18px 18px; border-radius: 22px; }
  .levelup-card h2 { font-size: 15px; }
  .levelup-wordichi-icon { width: 76px; height: 76px; font-size: 46px; }
}

/* Client-only build tweaks */
.wordichi-name-input:disabled {
  opacity: 1;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.74);
  color: #1f2937;
  font-weight: 900;
  text-align: center;
}

/* Buddy picker: keep button visible, scroll only skins grid */
#create-wordichi-card,
.create-wordichi-card,
.wordichi-create-card {
  /*max-height: min(92vh, 760px);*/
  display: flex;
  flex-direction: column;
  /*overflow: hidden;*/
  align-items: center;
}

#wordichi-grid,
.wordichi-grid {
  flex: 1;
  min-height: 0;
  /*max-height: 360px;*/
  /*overflow-y: auto;*/
  padding-right: 6px;
  padding-top: 3px;
  /*overscroll-behavior: contain;*/
}

/* button area always visible */
#adopt-btn {
  position: sticky;
  bottom: 4px;
  flex-shrink: 0;
  /*margin-top: 16px;*/
  opacity: 1;
}

#adopt-btn:disabled {
  display: none;
}

/* optional: prettier scroll */
#wordichi-grid::-webkit-scrollbar,
.wordichi-grid::-webkit-scrollbar {
  width: 8px;
}

#wordichi-grid::-webkit-scrollbar-thumb,
.wordichi-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .25);
  border-radius: 999px;
}

#wordichi-grid::-webkit-scrollbar-track,
.wordichi-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, .08);
  border-radius: 999px;
}

.buddy-name-box,
.buddy-name-box * {
  box-sizing: border-box;
}

.buddy-name-box {
  /*width: 620px;*/
  /*max-width: calc(100vw - 40px);*/
  width: 100%;
  height: 3.5rem;
  /*height: 86px;*/
  margin: 0 auto 24px;

  display: flex;
  align-items: center;

  border-radius: 26px;
  border: 4px solid #303045;
  background: #171725;

  box-shadow:
          inset 0 4px 0 rgba(255,255,255,.05),
          inset 0 -5px 0 rgba(0,0,0,.22),
          0 10px 0 rgba(0,0,0,.25);
  /*overflow: hidden;*/
}

.buddy-name-box__label {
  height: 100%;
  display: flex;
  align-items: center;
  /* justify-content: center; */
  color: #f4bd55;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, .025);
  border-right: 3px solid #303045;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .55), 0 0 12px rgba(244, 189, 85, .22);
  padding: 0 1rem;
}

.buddy-name-box__input {
  flex: 1;
  min-width: 0;
  height: 100%;

  border: 0;
  outline: 0;
  /*padding: 0 24px;*/
  margin: 0;

  background: transparent;
  box-shadow: none;

  color: #fff;
  -webkit-text-fill-color: #fff;
  opacity: 1;

  font-size: 32px;
  font-weight: 900;
  letter-spacing: .06em;
  /*text-align: center;*/
  padding-left: 1rem;
  cursor: not-allowed;
}

.buddy-name-box__input:disabled {
  opacity: 1;
}

.buddy-name-box__signin {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 128px;
  border: 0;
  border-left: 3px solid #303045;
  border-radius: 0 22px 22px 0;
  background: rgba(255,255,255,.025);
  color: #f4bd55;
  font-size: .8rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: 0 3px 0 rgba(0,0,0,.55), 0 0 12px rgba(244,189,85,.22);
  padding: 0 1rem;
  transition: background .15s ease, color .15s ease, transform .15s ease;
  white-space: nowrap;
}

.buddy-name-box__signin:hover {
  background: rgba(244,189,85,.10);
  color: #ffd88a;
}

.buddy-name-box__signin:active {
  transform: translateY(2px);
}


.buddy-server-box,
.buddy-server-box * {
  box-sizing: border-box;
}

.buddy-server-box {
  width: 100%;
  height: 3.5rem;
  margin: -10px auto 24px;
  display: flex;
  align-items: center;
  border-radius: 26px;
  border: 4px solid #303045;
  background: #171725;
  box-shadow:
          inset 0 4px 0 rgba(255,255,255,.05),
          inset 0 -5px 0 rgba(0,0,0,.22),
          0 10px 0 rgba(0,0,0,.25);
  overflow: hidden;
}

.buddy-server-box__label {
  height: 100%;
  display: flex;
  align-items: center;
  color: #f4bd55;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
  background: rgba(255,255,255,.025);
  border-right: 3px solid #303045;
  text-shadow: 0 3px 0 rgba(0,0,0,.55), 0 0 12px rgba(244,189,85,.22);
  padding: 0 1rem;
}

.buddy-server-box__select {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  margin: 0;
  padding: 0 3rem 0 1rem;
  appearance: none;
  -webkit-appearance: none;
  background:
          linear-gradient(45deg, transparent 50%, #f4bd55 50%) calc(100% - 1.35rem) 50% / 8px 8px no-repeat,
          linear-gradient(135deg, #f4bd55 50%, transparent 50%) calc(100% - 0.95rem) 50% / 8px 8px no-repeat,
          transparent;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: .04em;
  cursor: pointer;
}

.buddy-server-box__select:focus {
  background-color: rgba(244,189,85,.08);
}

.buddy-server-box__select option {
  color: #111827;
  background: #fff;
}


.buddy-server-dropdown {
  position: fixed;
  z-index: 2600;
  display: none;
  max-height: min(340px, calc(100vh - 28px));
  padding: 8px;
  border: 3px solid #303045;
  border-radius: 22px;
  background:
          radial-gradient(circle at 18% 0%, rgba(244,189,85,.18), transparent 34%),
          linear-gradient(180deg, #222238 0%, #151522 100%);
  box-shadow:
          inset 0 3px 0 rgba(255,255,255,.07),
          inset 0 -4px 0 rgba(0,0,0,.25),
          0 18px 0 rgba(0,0,0,.22),
          0 22px 42px rgba(0,0,0,.45);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.buddy-server-dropdown.is-open {
  display: block;
}

.buddy-server-dropdown::-webkit-scrollbar {
  width: 8px;
}

.buddy-server-dropdown::-webkit-scrollbar-track {
  background: rgba(255,255,255,.04);
  border-radius: 999px;
}

.buddy-server-dropdown::-webkit-scrollbar-thumb {
  background: rgba(244,189,85,.42);
  border-radius: 999px;
}


.buddy-server-dropdown__empty {
  padding: 16px 18px;
  color: rgba(255, 255, 255, 0.64);
  font-weight: 900;
  text-align: center;
}

.buddy-server-dropdown__item {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: rgba(255,255,255,.86);
  font: inherit;
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: .02em;
  text-align: left;
  padding: 9px 12px;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, transform .14s ease;
}

.buddy-server-dropdown__item:hover,
.buddy-server-dropdown__item.is-active {
  background: rgba(244,189,85,.12);
  color: #fff4cf;
}

.buddy-server-dropdown__item:active {
  transform: translateY(2px);
}

.buddy-server-dropdown__flag {
  width: 34px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 11px;
  background: rgba(255,255,255,.08);
  color: #f4bd55;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.08);
  font-size: .9rem;
  font-weight: 950;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.buddy-server-dropdown__item.is-active .buddy-server-dropdown__flag {
  background: rgba(244,189,85,.18);
}

.buddy-server-dropdown__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.buddy-server-dropdown__check {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(244,189,85,.18);
  color: #ffd88a;
  font-size: .82rem;
  font-weight: 950;
  opacity: 0;
}

.buddy-server-dropdown__item.is-active .buddy-server-dropdown__check {
  opacity: 1;
}

.auth-pin-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 20%, rgba(127,119,221,.24), transparent 34%),
    rgba(4,4,10,.72);
  backdrop-filter: blur(12px);
}

.auth-pin-modal.is-open {
  display: flex;
}

.auth-pin-card {
  position: relative;
  width: min(420px, 100%);
  border-radius: 28px;
  border: 4px solid #303045;
  background: linear-gradient(180deg, #1d1d31 0%, #141421 100%);
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.06),
    inset 0 -6px 0 rgba(0,0,0,.24),
    0 24px 60px rgba(0,0,0,.48),
    0 0 44px rgba(127,119,221,.18);
  padding: 30px 24px 24px;
  text-align: center;
  animation: authPinPop .18s ease-out;
}

@keyframes authPinPop {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-pin-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.76);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.auth-pin-close:hover {
  background: rgba(255,255,255,.11);
  color: #fff;
}

.auth-pin-orb {
  width: 68px;
  height: 68px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(250,199,117,.22), rgba(127,119,221,.18));
  border: 2px solid rgba(250,199,117,.35);
  font-size: 34px;
  box-shadow: 0 12px 28px rgba(0,0,0,.28), 0 0 22px rgba(250,199,117,.16);
}

.auth-pin-card h2 {
  margin: 0 0 8px;
  color: var(--amber-200);
  font-family: var(--font-pixel);
  font-size: .92rem;
  line-height: 1.5;
  text-shadow: 2px 2px 0 var(--amber-600);
}

.auth-pin-card p {
  margin: 0 0 20px;
  color: rgba(255,255,255,.68);
  font-weight: 800;
}

.auth-pin-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.auth-pin-form--hidden {
  display: none;
}

.auth-pin-form label {
  color: #f4bd55;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0,0,0,.5);
}

.auth-pin-form input {
  width: 100%;
  border: 3px solid #303045;
  border-radius: 18px;
  background: #10101c;
  color: #fff;
  outline: 0;
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.04), inset 0 -4px 0 rgba(0,0,0,.20);
}

.auth-pin-form input:focus {
  border-color: rgba(250,199,117,.78);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.04), 0 0 0 4px rgba(250,199,117,.12);
}

.auth-pin-form .btn-primary {
  width: 100%;
  margin-top: 2rem;
  padding: 13px 18px;
}

.auth-pin-form .btn-primary.is-loading {
  pointer-events: none;
  opacity: .65;
}

.auth-pin-back {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.62);
  font-weight: 900;
  padding: 6px;
}

.auth-pin-back:hover {
  color: var(--amber-200);
}

.auth-pin-message {
  margin-top: 14px;
  color: rgba(255,255,255,.70);
  font-size: .9rem;
  font-weight: 800;
  text-align: center;
}

.auth-pin-message:empty {
  display: none;
}

.auth-pin-message.is-error {
  color: #ff9f9f;
}

.auth-pin-message.is-success {
  color: #9FE1CB;
}

@media (max-width: 560px) {
  .buddy-name-box {
    height: auto;
    min-height: 3.5rem;
    flex-wrap: wrap;
    overflow: hidden;
  }

  .buddy-name-box__label {
    min-height: 3.5rem;
  }

  .buddy-name-box__input {
    min-height: 3.5rem;
    font-size: 1.35rem;
  }

  .buddy-name-box__signin {
    width: 100%;
    min-height: 3rem;
    border-left: 0;
    border-top: 3px solid #303045;
    border-radius: 0 0 20px 20px;
  }

  .buddy-server-box {
    height: 3.25rem;
    margin-top: -8px;
    border-radius: 22px;
  }

  .buddy-server-box__label {
    font-size: .88rem;
    letter-spacing: .12em;
  }

  .buddy-server-box__select {
    font-size: 1rem;
    padding-left: .8rem;
  }
}
/* Sleep toggle state */
.action-btn[data-action="sleep"].is-sleeping {
  background: linear-gradient(135deg, rgba(127,119,221,0.36), rgba(34,211,238,0.24));
  border-color: rgba(191,219,254,0.72);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.14) inset, 0 10px 28px rgba(79,70,229,0.24);
}

.action-btn[data-action="sleep"].is-sleeping .a-cost {
  color: #bfdbfe;
  font-weight: 900;
  letter-spacing: 0.08em;
}

/* Sleep lock + modal */
.action-btn.is-sleep-locked,
.earn-btn.is-sleep-locked {
  opacity: 0.42;
  filter: grayscale(0.55);
  cursor: not-allowed;
  transform: none !important;
}

.action-btn.is-sleep-locked:hover,
.earn-btn.is-sleep-locked:hover {
  background: rgba(255,255,255,0.08);
  filter: grayscale(0.55);
}

.shop-grid.is-sleep-locked .shop-card,
.shop-card.sleep-locked {
  opacity: 0.48;
  filter: grayscale(0.5);
  cursor: not-allowed;
  pointer-events: none;
}

.sleep-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(191,219,254,0.24), transparent 34%),
    radial-gradient(circle at 20% 80%, rgba(127,119,221,0.28), transparent 28%),
    rgba(5, 10, 24, 0.76);
  backdrop-filter: blur(12px);
}

.sleep-modal.show { display: flex; }

.sleep-card {
  position: relative;
  width: min(430px, 100%);
  overflow: hidden;
  border: 1px solid rgba(219,234,254,0.44);
  border-radius: 28px;
  padding: 28px 24px 22px;
  text-align: center;
  color: #eef6ff;
  background:
    linear-gradient(180deg, rgba(26,34,74,0.96), rgba(10,15,35,0.98)),
    radial-gradient(circle at 50% 0%, rgba(147,197,253,0.36), transparent 40%);
  box-shadow:
    0 28px 80px rgba(0,0,0,0.48),
    0 0 0 1px rgba(255,255,255,0.08) inset,
    0 0 42px rgba(127,119,221,0.22);
}

.sleep-card::before {
  content: '';
  position: absolute;
  inset: -90px -80px auto auto;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: rgba(125,211,252,0.18);
  filter: blur(4px);
}

.sleep-orb {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 26px;
  font-size: 42px;
  background: linear-gradient(135deg, rgba(147,197,253,0.24), rgba(167,139,250,0.22));
  box-shadow: 0 14px 34px rgba(59,130,246,0.24), 0 0 0 1px rgba(255,255,255,0.14) inset;
  animation: sleep-float 2.1s ease-in-out infinite;
}

.sleep-card h2 {
  position: relative;
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.sleep-card p {
  position: relative;
  margin: 0 auto 18px;
  max-width: 330px;
  color: rgba(226,232,240,0.78);
  font-size: 13px;
  line-height: 1.55;
}

.sleep-stars span {
  position: absolute;
  color: rgba(219,234,254,0.8);
  text-shadow: 0 0 14px rgba(147,197,253,0.8);
  animation: sleep-twinkle 1.6s ease-in-out infinite;
}
.sleep-stars span:nth-child(1) { left: 48px; top: 44px; }
.sleep-stars span:nth-child(2) { right: 54px; top: 58px; animation-delay: .35s; }
.sleep-stars span:nth-child(3) { right: 90px; bottom: 86px; animation-delay: .7s; }

.sleep-meter {
  position: relative;
  margin: 10px 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  background: rgba(255,255,255,0.07);
}

.sleep-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  color: rgba(241,245,249,0.86);
}

.sleep-meter-head strong {
  font-size: 12px;
  color: #fff;
}

.sleep-meter-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15,23,42,0.82);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

.sleep-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.22s linear;
}

.sleep-meter-fill.energy {
  background: linear-gradient(90deg, #818cf8, #60a5fa, #67e8f9);
  box-shadow: 0 0 12px rgba(96,165,250,0.58);
}

.sleep-meter-fill.hunger {
  background: linear-gradient(90deg, #f59e0b, #fbbf24, #fde68a);
  box-shadow: 0 0 12px rgba(251,191,36,0.42);
}

.sleep-wake-btn {
  position: relative;
  width: 100%;
  margin-top: 14px;
  border-radius: 16px;
  padding: 13px 16px;
  font-size: 14px;
  box-shadow: 0 10px 0 rgba(30,64,175,0.42), 0 18px 34px rgba(37,99,235,0.25);
}

.sleep-wake-btn:active {
  transform: translateY(3px);
  box-shadow: 0 7px 0 rgba(30,64,175,0.42), 0 12px 24px rgba(37,99,235,0.22);
}

@keyframes sleep-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-7px) rotate(2deg); }
}

@keyframes sleep-twinkle {
  0%, 100% { transform: scale(.86); opacity: .42; }
  50% { transform: scale(1.25); opacity: 1; }
}

@media (max-width: 520px) {
  .sleep-card { padding: 24px 18px 18px; border-radius: 24px; }
  .sleep-orb { width: 74px; height: 74px; font-size: 36px; }
  .sleep-card h2 { font-size: 21px; }
}

/* ── Wordichi click stat floats ─────────────────────────────────────────── */
.stat-float {
  position: absolute;
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(10, 15, 28, 0.72);
  box-shadow: 0 9px 22px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.16);
  color: #fff;
  font-family: var(--font-pixel);
  font-size: 7px;
  line-height: 1;
  pointer-events: none;
  transform: translate3d(0, 0, 0) scale(0.88);
  animation: stat-float-pop 1.05s cubic-bezier(.18,.82,.22,1) forwards;
  backdrop-filter: blur(8px);
}
.stat-float-icon {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1;
}
.stat-float-value {
  transform: translateY(1px);
  text-shadow: 0 1px 3px rgba(0,0,0,0.55);
}
.stat-float-xp .stat-float-icon {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: #fff7bf;
}
.stat-float-energy {
  background: linear-gradient(135deg, rgba(88,80,210,0.84), rgba(18,23,44,0.76));
}
.stat-float-happy {
  background: linear-gradient(135deg, rgba(239,159,39,0.9), rgba(75,43,15,0.74));
}
.stat-float-xp {
  background: linear-gradient(135deg, rgba(250,199,117,0.92), rgba(127,119,221,0.78));
}
@keyframes stat-float-pop {
  0% {
    opacity: 0;
    transform: translate3d(0, 10px, 0) scale(0.72);
  }
  16% {
    opacity: 1;
    transform: translate3d(var(--float-x), -4px, 0) scale(1.04);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--float-x), -110px, 0) scale(1.12);
  }
}

/* ── Effect tooltips for actions/shop ───────────────────────────────────── */
.action-btn,
.shop-card {
  position: relative;
}

.action-btn[data-effect-tooltip],
.shop-card[data-effect-tooltip] {
  isolation: isolate;
}


.action-btn[data-effect-tooltip]:has(.effect-info:hover),
.action-btn[data-effect-tooltip]:has(.effect-info:focus-visible),
.shop-card[data-effect-tooltip]:has(.effect-info:hover),
.shop-card[data-effect-tooltip]:has(.effect-info:focus-visible) {
  z-index: 999;
}

.effect-info {
  position: absolute;
  z-index: 100000;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(250,199,117,0.58);
  background: linear-gradient(180deg, rgba(250,199,117,0.28), rgba(250,199,117,0.12));
  color: var(--amber-200);
  box-shadow: 0 6px 16px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.16);
  font-family: var(--font-pixel);
  line-height: 1;
  font-weight: 900;
  cursor: help;
  transition: opacity 0.12s ease, transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  right: 3px;
  top: 3px;
  height: 12px;
  width: 12px;
  font-size: .4rem;
  opacity: .4;
}
.shop-card .effect-info {
  right: 4px;
  top: 4px;
  opacity: .25;
}
/*.shop-card .effect-info {*/
/*  right: 12px;*/
/*  top: 10px;*/
/*  width: 20px;*/
/*  height: 20px;*/
/*  font-size: 9px;*/
/*}*/

.effect-info:hover,
.effect-info:focus-visible {
  opacity: 1;
  transform: translateY(-1px) scale(1.06);
  border-color: rgba(250,199,117,0.86);
  background: linear-gradient(180deg, rgba(250,199,117,0.42), rgba(250,199,117,0.18));
  outline: none;
}

.effect-tooltip {
  position: absolute;
  right: 0;
  top: 31px;
  transform: translateY(7px) scale(0.98);
  z-index: 99999;
  min-width: 218px;
  max-width: min(280px, 82vw);
  padding: 13px 14px 14px;
  border-radius: 16px;
  background: #24205a;
  border: 1px solid rgba(250,199,117,0.34);
  box-shadow: 0 18px 40px rgba(0,0,0,0.42), 0 0 22px rgba(127,119,221,0.26);
  color: #fff;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
  font-family: var(--font-pixel);
  text-align: left;
  white-space: normal;
}

.shop-card .effect-tooltip {
  right: 8px;
  top: 36px;
}

.effect-tooltip::after {
  content: '';
  position: absolute;
  right: 10px;
  top: -6px;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  background: #24205a;
  border-left: 1px solid rgba(250,199,117,0.28);
  border-top: 1px solid rgba(250,199,117,0.28);
}

.shop-card .effect-tooltip::after {
  right: 15px;
}

.effect-tooltip-title {
  display: block;
  margin-bottom: 10px;
  color: var(--amber-200);
  font-size: 8px;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.effect-tooltip-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.effect-tooltip-row {
  display: grid;
  grid-template-columns: 28px 46px 1fr;
  align-items: center;
  column-gap: 8px;
  min-height: 28px;
  padding: 6px 8px;
  border-radius: 11px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.09);
}

.effect-tooltip-row-note {
  grid-template-columns: 28px 1fr;
}

.effect-tooltip-icon {
  width: 28px;
  min-width: 28px;
  text-align: center;
  font-size: 20px;
  line-height: 1;
  font-family: 'Nunito', system-ui, sans-serif;
}

.effect-tooltip-value {
  font-size: 9px;
  line-height: 1;
  font-weight: 900;
}

.effect-tooltip-label {
  min-width: 0;
  font-size: 8px;
  line-height: 1.45;
  color: rgba(255,255,255,0.9);
}

.effect-tooltip-row-good .effect-tooltip-value { color: #96f6c8; }
.effect-tooltip-row-bad .effect-tooltip-value { color: #ffb4b4; }
.effect-tooltip-row-note .effect-tooltip-label { grid-column: 2 / 4; color: rgba(255,255,255,0.82); }

.effect-info:hover + .effect-tooltip,
.effect-info:focus-visible + .effect-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

@media (max-width: 680px) {
  .effect-tooltip {
    right: 50%;
    top: 31px;
    transform: translate(50%, 7px) scale(0.98);
    min-width: 205px;
    max-width: min(245px, 86vw);
    padding: 12px;
  }

  .shop-card .effect-tooltip {
    right: 8px;
    transform: translateY(7px) scale(0.98);
  }

  .effect-tooltip::after {
    right: calc(50% - 6px);
  }

  .shop-card .effect-tooltip::after {
    right: 15px;
  }

  .effect-info:hover + .effect-tooltip,
  .effect-info:focus-visible + .effect-tooltip {
    transform: translate(50%, 0) scale(1);
  }

  .shop-card .effect-info:hover + .effect-tooltip,
  .shop-card .effect-info:focus-visible + .effect-tooltip {
    transform: translateY(0) scale(1);
  }

  .effect-tooltip-row {
    grid-template-columns: 26px 42px 1fr;
    column-gap: 7px;
  }

  .effect-tooltip-icon {
    width: 26px;
    min-width: 26px;
    font-size: 18px;
  }
}

/* ── Word rooms ─────────────────────────────────────────────────────────── */
.word-rooms-panel {
  border-color: rgba(127,119,221,0.22);
  background:
    radial-gradient(circle at 12% 0%, rgba(127,119,221,0.16), transparent 36%),
    var(--bg2);
}

.word-rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.word-room-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.035));
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.word-room-card:hover {
  transform: translateY(-2px);
  border-color: rgba(250,199,117,0.28);
  background: linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.045));
}

.word-room-card.is-locked,
.word-room-card.low-energy,
.word-room-card.sleep-locked {
  opacity: 0.55;
}

.word-room-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.word-room-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid rgba(250,199,117,0.26);
  background: linear-gradient(180deg, rgba(250,199,117,0.2), rgba(127,119,221,0.14));
  color: var(--amber-200);
  font-family: var(--font-pixel);
  font-size: 1.2rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.word-room-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.word-room-title strong {
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 900;
}

.word-room-title span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.word-room-rewards {
  display: grid;
  gap: 7px;
}

.word-room-effect-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  /*padding: 6px;*/
  border: 0;
  /*border-radius: 14px;*/
  border-radius: 14px 0 0 14px;
  background: rgba(255,255,255,0.04);
}

.word-room-effect-group.is-win {
  /*background: linear-gradient(90deg, rgba(34,197,94,0.1), rgba(255,255,255,0.035));*/
  background: linear-gradient(
          90deg,
          rgba(34,197,94,0.1) 0%,
          rgba(34,197,94,0.06) 45%,
          rgba(34,197,94,0.025) 70%,
          rgba(34,197,94,0) 100%
  );
}

.word-room-effect-group.is-cost {
  /*background: linear-gradient(90deg, rgba(248,113,113,0.1), rgba(255,255,255,0.035));*/
  background: linear-gradient(
          90deg,
          rgba(248,113,113,0.1) 0%,
          rgba(248,113,113,0.06) 45%,
          rgba(248,113,113,0.025) 70%,
          rgba(248,113,113,0) 100%
  );
}

.word-room-group-label {
  width: 36px;
  padding: 9px 6px;
  border-radius: 999px 0 0 999px;
  background: rgba(0,0,0,0.16);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  letter-spacing: 0.06em;
}

.word-room-chip {
  /*flex: 1 1 0;*/
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 7px;
  /*border-radius: 999px;*/
  /*border: 1px solid rgba(255,255,255,0.09);*/
  /*background: rgba(255,255,255,0.07);*/
  color: rgba(255,255,255,0.88);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  /*box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);*/
}

.word-room-chip b {
  font-size: 9px;
  color: var(--amber-200);
}

.word-room-play {
  min-height: 34px;
  border: 1px solid rgba(250,199,117,0.32);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--amber-200), var(--amber-400));
  color: #412402;
  font-family: var(--font-pixel);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 0 var(--amber-600);
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.word-room-play:hover:not(:disabled) { filter: brightness(1.05); }
.word-room-play:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--amber-600); }
.word-room-play:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.2);
}

.word-rooms-grid.is-sleep-locked .word-room-card { opacity: 0.48; }

@media (max-width: 680px) {
  .word-rooms-grid { grid-template-columns: 1fr; }
  .word-room-card { padding: 11px; }
}

.stat-row.stat-zero .stat-icon,
.stat-bg.stat-zero,
.stat-val.stat-zero {
  animation: stat-zero-blink 0.75s steps(2, end) infinite;
}

.stat-bg.stat-zero {
  border-color: rgba(255, 74, 74, 0.9);
  box-shadow: 0 0 8px rgba(255, 74, 74, 0.55), inset 0 0 8px rgba(255, 74, 74, 0.16);
}

.stat-val.stat-zero {
  color: #fff;
  text-shadow: 0 0 5px rgba(255, 74, 74, 0.95), 0 1px 2px rgba(0,0,0,0.9);
}

.action-btn.is-hunger-locked {
  opacity: 0.56;
  cursor: not-allowed;
  filter: grayscale(0.45);
}

@keyframes stat-zero-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}


/* ── Index landing / SEO intro ─────────────────────────────────────────── */
body {
  position: relative;
  min-height: 100%;
  background: #0e0e1a;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url('/static/img/body-bg.jpg') center top / cover no-repeat;
  transform: translateZ(0);
}



@media (max-width: 700px) {
  body::before {
    background-image: url('/static/img/bg-mobile.webp');
    background-position: center top;
  }
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 12%, rgba(250,199,117,0.12), transparent 28%),
    linear-gradient(180deg, rgba(6,18,24,0.12), rgba(14,14,26,0.76) 74%, rgba(14,14,26,0.9));
}

#app {
  position: relative;
  z-index: 1;
  max-width: 1080px;
}

.wordichi-landing {
  position: relative;
  max-width: 1080px;
  margin: 4px auto 30px;
  color: #2e351d;
}

.wordichi-hero {
  position: relative;
  text-align: center;
  padding: 34px 16px 22px;
  min-height: 190px;
}

.wordichi-hero::before,
.wordichi-hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: .9;
}

.wordichi-hero::before {
  left: 8%;
  top: 54px;
  width: 84px;
  height: 84px;
  border-radius: 18px;
  transform: rotate(-13deg);
  background: linear-gradient(180deg, #fff3cf, #d5ad64);
  border: 4px solid rgba(113, 74, 22, .28);
  box-shadow: 0 10px 20px rgba(0,0,0,.28), inset 0 2px 0 rgba(255,255,255,.72);
}

.wordichi-hero::after {
  right: 9%;
  top: 44px;
  width: 84px;
  height: 84px;
  border-radius: 18px;
  transform: rotate(12deg);
  background: linear-gradient(180deg, #fff3cf, #d5ad64);
  border: 4px solid rgba(113, 74, 22, .28);
  box-shadow: 0 10px 20px rgba(0,0,0,.28), inset 0 2px 0 rgba(255,255,255,.72);
}

.wordichi-hero__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 20px;
  border-radius: 999px;
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #f8e8b2;
  background: linear-gradient(180deg, #2f6b30, #163b1e);
  border: 2px solid rgba(250,199,117,.48);
  box-shadow: 0 7px 0 rgba(42, 71, 21, .55), 0 14px 28px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.22);
}

.wordichi-hero h1 {
  margin: 18px 0 10px;
  font-family: var(--font-pixel);
  font-size: clamp(2.1rem, 8vw, 5rem);
  line-height: 1.05;
  letter-spacing: .03em;
  color: #fff1b8;
  text-shadow:
    0 3px 0 #8b5a1a,
    0 7px 0 #234c24,
    0 14px 24px rgba(0,0,0,.34),
    0 0 24px rgba(250,199,117,.34);
}

.wordichi-hero__lead {
  max-width: 720px;
  margin: 0 auto;
  color: rgba(255,255,255,.86);
  font-size: clamp(1rem, 2vw, 1.22rem);
  font-weight: 800;
  text-shadow: 0 2px 12px rgba(0,0,0,.4);
}

.wordichi-hero__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  margin-bottom: 18px;
}

.wordichi-hero__chips span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 246, 211, .92);
  border: 1px solid rgba(141, 104, 41, .28);
  color: #415022;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.75);
}

.wordichi-guide-panel {
  position: relative;
  padding: 58px 34px 32px;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 250, 229, .96), rgba(247, 235, 195, .96));
  border: 4px solid rgba(139, 94, 34, .24);
  box-shadow:
    0 20px 48px rgba(0,0,0,.28),
    inset 0 0 0 2px rgba(255,255,255,.52),
    inset 0 0 60px rgba(186,117,23,.10);
}

.wordichi-guide-panel::before,
.wordichi-guide-panel::after {
  content: "✧";
  position: absolute;
  top: 24px;
  color: rgba(156, 103, 22, .42);
  font-size: 28px;
}

.wordichi-guide-panel::before { left: 24px; }
.wordichi-guide-panel::after { right: 24px; }

.wordichi-guide-ribbon {
  position: absolute;
  left: 50%;
  top: -24px;
  transform: translateX(-50%);
  min-width: min(420px, calc(100% - 40px));
  padding: 13px 28px 12px;
  border-radius: 12px;
  text-align: center;
  font-family: var(--font-pixel);
  font-size: clamp(11px, 2vw, 17px);
  letter-spacing: .10em;
  text-transform: uppercase;
  color: #fff1c7;
  background: linear-gradient(180deg, #2e6a30, #173c1f);
  border: 2px solid rgba(250,199,117,.55);
  box-shadow: 0 8px 0 rgba(42, 71, 21, .66), 0 16px 26px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.20);
}

.wordichi-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.wordichi-step-card {
  position: relative;
  min-height: 220px;
  padding: 42px 18px 20px;
  text-align: center;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,253,242,.92), rgba(244,229,185,.88));
  border: 2px solid rgba(204, 155, 74, .35);
  box-shadow: 0 10px 18px rgba(87,55,16,.12), inset 0 1px 0 rgba(255,255,255,.8);
}

.wordichi-step-num {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-pixel);
  font-size: 15px;
  color: #fff7d4;
  background: linear-gradient(180deg, #4c842d, #223f1d);
  border: 2px solid rgba(250,199,117,.5);
  box-shadow: 0 5px 0 rgba(55,74,18,.55), 0 9px 18px rgba(0,0,0,.18);
}

.wordichi-step-card h2,
.wordichi-section-head h2,
.wordichi-section-head2 h2 {
  font-family: var(--font-pixel);
  color: #415022;
  text-transform: uppercase;
}

.wordichi-section-head2 h2 {
  font-size: 1.2rem;
  margin: 1rem 0 .5rem;
}

.wordichi-step-card h2 {
  margin: 18px 0 8px;
  font-size: 12px;
  letter-spacing: .08em;
}

.wordichi-step-card p {
  color: #2f2f2b;
  font-weight: 800;
  line-height: 1.4;
}

.wordichi-step-visual {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.wordichi-step-visual--pick span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #fff7d9;
  border: 2px solid rgba(150, 100, 32, .22);
  box-shadow: 0 7px 12px rgba(87,55,16,.15);
  font-size: 24px;
}

.wordichi-step-visual--stats span,
.wordichi-step-visual--keyboard span {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(39, 80, 32, .10);
  border: 1px solid rgba(39, 80, 32, .18);
  font-weight: 900;
}

.wordichi-step-visual--tiles span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-family: var(--font-pixel);
  font-size: 12px;
  color: #4b3414;
  background: linear-gradient(180deg, #fff2ca, #d9b46b);
  border: 2px solid rgba(94, 63, 21, .22);
  box-shadow: 0 5px 0 rgba(103,73,28,.22);
}

.wordichi-room-strip {
  margin-top: 28px;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255,255,255,.45);
  border: 2px solid rgba(139, 94, 34, .18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

.wordichi-strip-title,
.wordichi-section-kicker {
  font-family: var(--font-pixel);
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #5f6a2b;
}

.wordichi-strip-title {
  text-align: center;
  font-size: 10px;
  margin-bottom: 12px;
}

.wordichi-room-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}

.wordichi-room-list span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(47,107,48,.12), rgba(47,107,48,.05));
  border: 1px solid rgba(39, 80, 32, .20);
  color: #34431f;
  font-size: 13px;
  font-weight: 900;
}

.wordichi-skills-showcase {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(139, 94, 34, .22);
}

.wordichi-section-head {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 18px;
}

.wordichi-section-kicker {
  display: inline-block;
  font-size: 9px;
  margin-bottom: 10px;
}

.wordichi-section-head h2 {
  margin-bottom: 10px;
  font-size: clamp(14px, 2vw, 20px);
  letter-spacing: .08em;
}

.wordichi-section-head p {
  color: #2f2f2b;
  font-weight: 800;
}

.wordichi-skills-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.wordichi-skill-mini {
  min-height: 160px;
  padding: 12px 9px 13px;
  text-align: center;
  border-radius: 16px;
  background: rgba(255,253,242,.72);
  border: 1px solid rgba(139, 94, 34, .18);
  box-shadow: 0 8px 16px rgba(87,55,16,.08), inset 0 1px 0 rgba(255,255,255,.65);
}

.wordichi-skill-mini strong {
  display: block;
  margin: 6px 0 5px;
  color: #3f4d23;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
}

.wordichi-skill-mini small {
  display: block;
  color: #34342f;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.wordichi-skill-icon {
  display: block;
  width: 65px;
  height: 68px;
  margin: 0 auto;
  background-image: url('/static/img/skillsprite_100px.png');
  background-repeat: no-repeat;
  background-size: 267px 224px;
  filter: drop-shadow(0 5px 9px rgba(60, 42, 13, .22));
}

.wordichi-skill-icon[data-skill="remove-wrong"] { background-position: -68px 0; }
.wordichi-skill-icon[data-skill="extra-guess"] { background-position: -135px 0; }
.wordichi-skill-icon[data-skill="time-boost"] { background-position: -202px 0; }
.wordichi-skill-icon[data-skill="safe-guess"] { background-position: 0 -80px; }
.wordichi-skill-icon[data-skill="clue-word"] { background-position: -68px -80px; }
.wordichi-skill-icon[data-skill="more-time"] { background-position: -135px -80px; }
.wordichi-skill-icon[data-skill="better-rewards"] { background-position: -202px -80px; }
.wordichi-skill-icon[data-skill="streak-shield"] { background-position: 0 -157px; }
.wordichi-skill-icon[data-skill="cooldown-reduction"] { background-position: -68px -157px; }
.wordichi-skill-icon[data-skill="lucky-reveal"] { background-position: -135px -157px; }
.wordichi-skill-icon[data-skill="smart-warnings"] { background-position: -202px -157px; }

#pick-wordichi {
  scroll-margin-top: 86px;
  position: relative;
  margin-top: 30px;
  padding: 26px;
  border-radius: 26px;
  background: rgba(22, 22, 42, .82);
  border: 1px solid rgba(250,199,117,.18);
  box-shadow: 0 18px 42px rgba(0,0,0,.26), inset 0 1px 0 rgba(255,255,255,.06);
}

#pick-wordichi::before {
  content: "Create Wordichi";
  display: inline-flex;
  justify-content: center;
  min-width: min(360px, calc(100% - 40px));
  position: absolute;
  left: 50%;
  top: -19px;
  transform: translateX(-50%);
  padding: 9px 20px;
  border-radius: 12px;
  font-family: var(--font-pixel);
  font-size: 10px;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: #fff1c7;
  background: linear-gradient(180deg, #2e6a30, #173c1f);
  border: 2px solid rgba(250,199,117,.45);
  box-shadow: 0 7px 0 rgba(42, 71, 21, .5), 0 12px 20px rgba(0,0,0,.22);
}

#pick-wordichi h1 {
  margin-top: 8px;
}

@media (max-width: 1100px) {
  .wordichi-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wordichi-skills-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  #app { padding: 16px; }
  .wordichi-hero { padding-top: 24px; min-height: 160px; }
  .wordichi-hero::before,
  .wordichi-hero::after { display: none; }
  .wordichi-guide-panel { padding: 52px 14px 18px; border-radius: 22px; }
  .wordichi-guide-ribbon { font-size: 10px; padding-inline: 16px; }
  .wordichi-steps { grid-template-columns: 1fr; gap: 18px; }
  .wordichi-step-card { min-height: 0; }
  .wordichi-skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wordichi-skill-mini { min-height: 148px; }
  #pick-wordichi { padding: 24px 14px 18px; }
}

@media (max-width: 420px) {
  .wordichi-skills-grid { grid-template-columns: 1fr; }
  .wordichi-room-list { justify-content: stretch; }
  .wordichi-room-list span { width: 100%; justify-content: center; text-align: center; }
}

/* Wordichi picker after sign-in */
.wordichi-select-modal {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 18%, rgba(250,199,117,.18), transparent 34%),
    radial-gradient(circle at 50% 78%, rgba(127,119,221,.22), transparent 42%),
    rgba(4,4,10,.74);
  backdrop-filter: blur(12px);
}
.wordichi-select-modal.is-open { display: flex; }
.wordichi-select-card {
  position: relative;
  width: min(540px, 100%);
  max-height: min(86vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 30px;
  border: 4px solid #303045;
  background: linear-gradient(180deg, #1d1d31 0%, #141421 100%);
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.06),
    inset 0 -6px 0 rgba(0,0,0,.24),
    0 24px 60px rgba(0,0,0,.52),
    0 0 44px rgba(250,199,117,.12);
  padding: 30px 22px 22px;
  text-align: center;
  animation: authPinPop .18s ease-out;
}
.wordichi-select-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.76);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}
.wordichi-select-close:hover { background: rgba(255,255,255,.11); color: #fff; }
.wordichi-select-orb {
  width: 68px;
  height: 68px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(250,199,117,.22), rgba(127,119,221,.18));
  border: 2px solid rgba(250,199,117,.35);
  font-size: 34px;
  box-shadow: 0 12px 28px rgba(0,0,0,.28), 0 0 22px rgba(250,199,117,.16);
}
.wordichi-select-card h2 {
  margin: 0 0 8px;
  color: var(--amber-200);
  font-family: var(--font-pixel);
  font-size: .92rem;
  line-height: 1.5;
  text-shadow: 2px 2px 0 var(--amber-600);
}
.wordichi-select-card p {
  margin: 0 0 16px;
  color: rgba(255,255,255,.68);
  font-weight: 800;
}
.wordichi-select-list {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 6px 4px 2px;
}
.wordichi-select-list::-webkit-scrollbar { width: 8px; }
.wordichi-select-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 999px; }
.wordichi-select-item {
  width: 100%;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  border: 2px solid rgba(255,255,255,.10);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.035));
  color: #fff;
  padding: 12px 14px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.06), 0 8px 0 rgba(0,0,0,.18);
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.wordichi-select-item:hover {
  transform: translateY(-2px);
  border-color: rgba(250,199,117,.42);
  background: linear-gradient(180deg, rgba(250,199,117,.12), rgba(255,255,255,.045));
}
.wordichi-select-item:active { transform: translateY(2px); box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.wordichi-select-skin {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 32px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.34));
}
.wordichi-select-main { flex: 1; min-width: 0; }
.wordichi-select-main strong {
  display: block;
  font-size: 1.08rem;
  font-weight: 950;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wordichi-select-main small {
  display: block;
  margin-top: 3px;
  color: rgba(255,255,255,.62);
  font-size: .82rem;
  font-weight: 850;
}
.wordichi-select-arrow {
  color: var(--amber-200);
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}
.wordichi-select-create {
  margin-top: 16px;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.68);
  font-weight: 950;
  padding: 8px;
}
.wordichi-select-create:hover { color: var(--amber-200); }

@media (max-width: 480px) {
  .wordichi-select-card { padding: 26px 16px 18px; border-radius: 24px; }
  .wordichi-select-item { min-height: 70px; padding: 10px 12px; gap: 10px; }
  .wordichi-select-skin { width: 46px; height: 46px; font-size: 28px; }
  .wordichi-select-main strong { font-size: .98rem; }
  .wordichi-select-main small { font-size: .76rem; }
}


/* Header server select */
.header-server-select {
  position: relative;
  flex: 0 0 auto;
  display: inline-block;
  width: max-content;
  min-width: 0;
  max-width: none;
}

.header-server-button {
  width: auto;
  min-width: 0;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 15px 0 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.085), rgba(255,255,255,.025)),
    rgba(23, 23, 38, .94);
  color: var(--text);
  box-shadow: 0 5px 0 rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.12);
  text-align: center;
  cursor: pointer;
}

.header-server-button:hover,
.header-server-select.is-open .header-server-button {
  border-color: rgba(250, 199, 117, .7);
  background:
    linear-gradient(180deg, rgba(250,199,117,.13), rgba(255,255,255,.035)),
    rgba(23, 23, 38, .96);
}

.header-server-title {
  min-width: 0;
  flex: 0 0 auto;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.header-server-chevron {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0;
  transform-origin: 50% 50%;
  transition: transform .14s ease;
}

.header-server-chevron::before {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--amber-200);
  border-bottom: 2px solid var(--amber-200);
  transform: rotate(45deg) translate(-1px, -1px);
}

.header-server-select.is-open .header-server-chevron { transform: rotate(180deg); }

.header-server-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 180;
  width: min(320px, calc(100vw - 24px));
  max-height: min(440px, calc(100vh - 90px));
  overflow-y: auto;
  display: none;
  padding: 8px;
  border: 1px solid rgba(250, 199, 117, .28);
  border-radius: 20px;
  background:
    radial-gradient(circle at 12% 0%, rgba(250,199,117,.16), transparent 34%),
    linear-gradient(180deg, rgba(31,31,50,.98), rgba(14,14,26,.98));
  box-shadow: 0 24px 70px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.1);
}

.header-server-select.is-open .header-server-menu { display: grid; gap: 7px; }

.header-server-menu::-webkit-scrollbar { width: 8px; }
.header-server-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 999px; }

.header-server-item {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 15px;
  background: rgba(255,255,255,.045);
  color: var(--text);
  text-align: left;
  box-shadow: 0 4px 0 rgba(0,0,0,.16);
  cursor: pointer;
}

.header-server-item:hover {
  border-color: rgba(250,199,117,.42);
  background: rgba(250,199,117,.1);
  transform: translateY(-1px);
}

.header-server-item.is-active {
  border-color: rgba(250,199,117,.6);
  background: linear-gradient(90deg, rgba(250,199,117,.16), rgba(255,255,255,.055));
}

.header-server-item.is-empty { opacity: .72; }

.header-server-item-skin {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: radial-gradient(circle at 35% 20%, rgba(255,255,255,.2), rgba(250,199,117,.12) 42%, rgba(0,0,0,.16));
  border: 1px solid rgba(255,255,255,.13);
  font-size: 19px;
  font-weight: 900;
}

.header-server-item-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.header-server-item-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 900;
}

.header-server-item-main small {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.header-server-item-go,
.header-server-item-empty {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  color: var(--amber-200);
  font-weight: 900;
}

.header-server-item-go span{
  font-size: 20px;
  line-height: 20px;
}

.header-server-item-empty { font-size: 15px; color: var(--text-muted); }

@media (max-width: 680px) {
  .topbar-game .topbar-nav {
    display: flex;
    padding-left: 0;
    flex: 0 0 auto;
    justify-content: center;
  }

  .header-server-button {
    height: 36px;
    padding: 0 12px 0 14px;
    border-radius: 14px;
  }

  .header-server-title {
    max-width: 135px;
    font-size: 13px;
  }

  .header-server-menu { left: 50%; transform: translateX(-50%); }
}
