/* sudoku.css */

.sk-root {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Header */
.sk-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 28px 14px;
  flex-shrink: 0;
  gap: 16px;
}
.sk-header-l { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sk-header-r { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sk-mark {
  width: 22px; height: 22px;
  display: grid; grid-template: 1fr 1fr / 1fr 1fr;
  gap: 1.5px; border: 1px solid; padding: 2px; border-radius: 3px;
  flex-shrink: 0;
}
.sk-mark span { background: currentColor; opacity: 0.18; border-radius: 1px; }
.sk-mark span:first-child { opacity: 1; }
.sk-title-block { min-width: 0; }
.sk-title-block h1 {
  margin: 0; font-size: 26px; letter-spacing: -0.01em; line-height: 1.05;
  font-weight: 500;
}
.sk-meta-row {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
  flex-wrap: wrap; position: relative;
}
.sk-meta-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  background: transparent; border: 1px solid; cursor: pointer;
  font-size: 12px; font-weight: 500;
}
.sk-meta-pill:hover { background: color-mix(in oklab, currentColor 8%, transparent); }
.sk-meta-stat {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.sk-diff-menu {
  position: absolute; top: 32px; left: 0;
  display: flex; flex-direction: column;
  border: 1px solid;
  padding: 4px; min-width: 120px; z-index: 5;
}
.sk-diff-item {
  display: block; width: 100%; text-align: left;
  height: 32px; padding: 0 10px;
  background: transparent; border: 0; cursor: pointer;
  font-size: 13px; font-weight: 500; border-radius: 8px;
}
.sk-diff-item:hover { background: color-mix(in oklab, currentColor 6%, transparent); }

.sk-icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid; cursor: pointer;
  transition: background 0.15s;
}
.sk-icon-btn:hover { background: color-mix(in oklab, currentColor 8%, transparent); }
.sk-text-btn {
  height: 36px; padding: 0 14px;
  background: transparent; border: 1px solid; cursor: pointer;
  font-size: 13px; font-weight: 500; letter-spacing: 0.02em;
  transition: background 0.15s;
}
.sk-text-btn:hover { background: color-mix(in oklab, currentColor 8%, transparent); }

/* Stage */
.sk-stage {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 22px; padding: 0 24px 24px;
  min-height: 0;
}

/* Board */
.sk-board-wrap {
  padding: 4px;
  width: min(100%, 540px);
  aspect-ratio: 1;
  flex-shrink: 0;
  overflow: hidden; /* keeps inset cell shadows from peeking past corners */
}
.sk-board {
  width: 100%; height: 100%;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  overflow: hidden;
  position: relative;
}
.sk-cell {
  position: relative; border: 0; padding: 0; margin: 0;
  font-size: clamp(18px, 4.6vw, 30px);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease;
  font-variant-numeric: lining-nums;
  line-height: 1;
}
.sk-cell:hover { filter: brightness(0.97); }
.sk-cell-ring { position: absolute; inset: 0; pointer-events: none; z-index: 1; }

/* Controls */
.sk-controls {
  width: min(100%, 540px);
  display: flex; flex-direction: column; gap: 12px;
}
.sk-toolrow { display: flex; align-items: center; gap: 8px; }
.sk-tool {
  height: 40px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid; cursor: pointer;
  font-size: 12.5px; letter-spacing: 0.02em; font-weight: 500;
  transition: background 0.15s, transform 0.08s;
}
.sk-tool:not(:disabled):hover { background: color-mix(in oklab, currentColor 6%, transparent); }
.sk-tool:not(:disabled):active { transform: translateY(1px); }
.sk-tool:disabled { cursor: default; }

.sk-numpad {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px;
}
.sk-numbtn {
  position: relative; aspect-ratio: 1; border: 1px solid; cursor: pointer;
  font-size: clamp(18px, 4.4vw, 26px);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, transform 0.08s, opacity 0.15s;
}
.sk-numbtn:not(:disabled):hover { background: color-mix(in oklab, var(--accent) 12%, var(--surface)); }
.sk-numbtn:not(:disabled):active { transform: translateY(1px) scale(0.98); }
.sk-numbtn em {
  position: absolute; bottom: 4px; right: 6px;
  font-size: 9px; font-style: normal; font-weight: 500; letter-spacing: 0.04em;
}
.sk-numbtn-done { cursor: default; opacity: 0.32; }
.sk-numbtn-done span { position: relative; }
.sk-numbtn-done span::after {
  content: ''; position: absolute;
  left: -8%; right: -8%; top: 52%; height: 1.5px;
  background: currentColor; transform: rotate(-12deg); transform-origin: center;
  opacity: 0.7;
}

/* Win overlay — fixed so it always covers the viewport regardless of any
   local stacking context the game shell might create. */
.sk-win {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: sk-fadein 0.35s ease;
  padding: 24px;
}
@keyframes sk-fadein { from { opacity: 0; } to { opacity: 1; } }
.sk-win-scrim {
  position: absolute; inset: 0;
  pointer-events: none;
}
.sk-win-card {
  text-align: center;
  padding: 56px 48px 36px;
  max-width: 420px; width: calc(100% - 48px);
  position: relative;
  z-index: 1;
  animation: sk-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes sk-pop {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.sk-win-burst {
  position: absolute; inset: 0 0 auto 0; height: 80px;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.sk-win-burst span {
  position: absolute; width: 3px; height: 12px; border-radius: 2px;
  transform-origin: center 46px; opacity: 0;
  animation: sk-burst 0.9s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
@keyframes sk-burst {
  0% { opacity: 0; transform: rotate(var(--rot, 0deg)) translateY(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--rot, 0deg)) translateY(-72px) scale(0.7); }
}
.sk-win-card h2 {
  margin: 8px 0 6px;
  font-size: 48px; letter-spacing: -0.02em; font-weight: 500; line-height: 1;
}
.sk-win-card p { margin: 0 0 22px; font-size: 14px; line-height: 1.5; }
.sk-win-actions { display: flex; gap: 10px; justify-content: center; }
.sk-win-btn {
  height: 42px; padding: 0 22px;
  border: 0; cursor: pointer;
  font-size: 13px; font-weight: 500; letter-spacing: 0.02em;
  transition: transform 0.1s, filter 0.15s;
}
.sk-win-btn:hover { filter: brightness(1.05); }
.sk-win-btn:active { transform: translateY(1px); }

/* Stats screen */
.sk-stats-root { overflow: auto; }
.sk-stats-scroll {
  flex: 1; overflow-y: auto;
  padding: 8px 28px 32px;
  display: flex; flex-direction: column; gap: 24px;
}
.sk-stats-empty {
  text-align: center; padding: 40px 24px 60px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.sk-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.sk-stat-card {
  border: 1px solid; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.sk-stat-label {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 500;
}
.sk-stat-value {
  font-size: 36px; line-height: 1.05; letter-spacing: -0.01em; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.sk-stat-hint { font-size: 12px; }
.sk-stats-section { display: flex; flex-direction: column; gap: 12px; }
.sk-stats-section h2 {
  margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.01em;
}
.sk-diff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.sk-diff-card {
  border: 1px solid; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.sk-diff-card header {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
}
.sk-diff-card dl {
  margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px;
}
.sk-diff-card dl > div { display: flex; flex-direction: column; gap: 2px; }
.sk-diff-card dt {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500;
}
.sk-diff-card dd {
  margin: 0; font-size: 18px; font-weight: 500;
}

.sk-act { border: 1px solid; padding: 18px 20px; }
.sk-act-bars {
  display: grid; grid-template-columns: repeat(14, 1fr);
  align-items: end; gap: 6px; height: 110px;
}
.sk-act-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sk-act-bar { width: 100%; min-height: 6px; transition: height 0.3s; }
.sk-act-label { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }

.sk-recent { border: 1px solid; padding: 4px 0; }
.sk-recent-row {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 18px;
  border-top: 1px solid;
  font-size: 13px;
}
.sk-recent-row:first-child { border-top: 0; }

/* Mobile */
@media (max-width: 540px) {
  .sk-header { padding: 14px 16px 8px; }
  .sk-stage { padding: 0 12px 14px; gap: 14px; }
  .sk-numpad { gap: 4px; }
  .sk-stats-scroll { padding: 8px 16px 24px; }
  .sk-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .sk-title-block h1 { font-size: 22px; }
  .sk-stat-value { font-size: 28px; }
}
