/* ---------- VATSAL FONT ---------- */
@font-face {
  font-family: "Vatsal-logo";
  src: url("../../assets/data/vatsal-logo-font.ttf") format("truetype");
  font-display: swap;
}

/* ---------- BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: "Outfit", sans-serif;
  background: linear-gradient(145deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #e8e8e8;
}

/* ---------- SCREEN SYSTEM ---------- */
.v-screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.v-screen.active { display: flex; }

.v-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 16px 16px;
  overflow-y: auto;
  min-height: 0;
}

.v-body.center {
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ---------- VATSAL HEADER ---------- */
.vatsal-header {
   flex-shrink: 0;
}

.vatsal-home {
  font-family: "Vatsal-logo" !important;
  font-size: 20px !important;
  color: rgba(255,255,255,.45) !important;
  text-decoration: none;
  pointer-events: all;
  cursor: pointer;
}

.vatsal-home:hover { color: #e94560 !important; }

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

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #a0a0b0;
  font-size: 0.95rem;
}

.level-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: #c0c0d0;
}

/* ---------- LEVEL SELECT ---------- */
.s-title {
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 700;
  margin: 0 0 6px;
  background: linear-gradient(135deg, #e94560, #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.s-sub {
  margin: 0 0 28px;
  color: #a0a0b0;
  font-size: 1rem;
}

.level-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(260px, 90%);
}

.level-btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 20px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  color: #1a1a2e;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.level-btn span { font-size: .8rem; opacity: .7; font-weight: 400; }
.level-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.3); }
.level-btn.easy   { background: linear-gradient(135deg, #6bcb77, #4ade80); }
.level-btn.medium { background: linear-gradient(135deg, #ffd93d, #fbbf24); }
.level-btn.hard   { background: linear-gradient(135deg, #e94560, #ef4444); color: #fff; }

/* ---------- GAME BODY ---------- */
.game-body {
  gap: 30px;
  align-items: center;
}

/* ---------- WIN BANNER ---------- */
.win-banner {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(106,203,119,.18), rgba(74,222,128,.08));
  border: 1px solid rgba(106,203,119,.35);
  animation: slideDown .4s ease;
  flex-shrink: 0;
}

.win-banner.hidden { display: none; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: none; }
}

.win-emoji { font-size: 1.6rem; flex-shrink: 0; }

.win-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.win-text strong { color: #6bcb77; font-size: .95rem; }
.win-text span   { color: #a0a0b0; font-size: .8rem; }

/* ---------- BOARD ---------- */
.board-wrapper {
  width: 100%;
  max-width: 480px;
  background: rgba(255,255,255,.04);
  border-radius: 14px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.board {
  display: grid;
  aspect-ratio: 1;
  width: 100%;
  border: 2px solid #e94560;
  border-radius: 8px;
  overflow: hidden;
  background: #0d0d1a;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.8rem, 3.5vw, 1.3rem);
  font-weight: 600;
  border: 1px solid rgba(255,255,255,.07);
  cursor: pointer;
  transition: background .12s;
  min-height: 0;
  min-width: 0;
}

.cell.given        { background: rgba(233,69,96,.1);  color: #ff8a9e; cursor: default; }
.cell.user         { color: #e8e8e8; }
.cell.selected     { background: rgba(233,69,96,.35); outline: 2px solid #e94560; outline-offset: -2px; z-index: 1; }
.cell.same-number  { background: rgba(233,69,96,.18); }
.cell.error        { color: #ef4444; background: rgba(239,68,68,.15); }
.cell.hint-cell    { color: #ffd93d !important; background: rgba(255,217,61,.12) !important; }
.cell.solved-cell  { color: #a0a0b0 !important; font-style: italic; }

.cell.cell-edge-r  { border-right-width:  2px; border-right-color:  rgba(255,255,255,.2); }
.cell.cell-edge-b  { border-bottom-width: 2px; border-bottom-color: rgba(255,255,255,.2); }

/* ---------- NUMBER PAD ---------- */
.number-pad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 480px;
  flex-shrink: 0;
}

.num-btn {
  font-family: inherit;
  font-size: clamp(.9rem, 3vw, 1.1rem);
  font-weight: 600;
  padding: clamp(8px, 2vw, 12px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  cursor: pointer;
  background: rgba(255,255,255,.07);
  color: #e8e8e8;
  transition: background .12s, transform .1s;
  touch-action: manipulation;
}

.num-btn:hover  { background: rgba(255,255,255,.14); }
.num-btn:active { transform: scale(.95); }

.num-btn-clear {
  grid-column: span 2;
  background: rgba(239,68,68,.18);
  color: #f87171;
  border-color: rgba(239,68,68,.25);
}

.num-btn-clear:hover { background: rgba(239,68,68,.3); }

/* ---------- ACTION BAR ---------- */
.action-bar {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 480px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.btn {
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  padding: 8px 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: #e94560;
  color: #fff;
  transition: background .2s, transform .1s;
  white-space: nowrap;
}

.btn:hover   { background: #ff6b6b; }
.btn:active  { transform: scale(.97); }

.btn-sm {
  padding: 6px 12px;
  font-size: .75rem;
  flex-shrink: 0;
}

.btn-ghost {
  background: transparent;
  color: #a0a0b0;
  border: 1px solid rgba(255,255,255,.15);
}

.btn-ghost:hover { background: rgba(255,255,255,.08); color: #e8e8e8; }

.btn-hint {
  background: rgba(255,217,61,.15);
  color: #ffd93d;
  border: 1px solid rgba(255,217,61,.25);
  flex: 1;
}

.btn-hint:hover    { background: rgba(255,217,61,.25); }
.btn-hint:disabled { opacity: .4; cursor: not-allowed; }

.btn-solve {
  background: rgba(255,255,255,.07);
  color: #a0a0b0;
  border: 1px solid rgba(255,255,255,.12);
  flex: 1;
}

.btn-solve:hover { background: rgba(255,255,255,.12); color: #e8e8e8; }

/* ---------- FOOTER IN GAME SCREEN ---------- */
#gameBody .vatsal-related {
  width: 100%;
  max-width: 480px;
  margin: 4px auto 0;
}

#gameBody .vatsal-related[hidden] { display: none !important; }
.vatsal-related-title { color: #a0a0b0 !important; }
.vatsal-footer a      { color: #606070 !important; }

/* ---------- MOBILE ---------- */
@media (max-width: 480px) {
  .v-body { padding: 8px 10px 12px; }
  .game-body { gap: 20px; }
  .board-wrapper { padding: 6px; border-radius: 10px; }
  .action-bar { gap: 6px; }
  .btn { padding: 7px 10px; font-size: .72rem; }
}