:root {
  --bg: #1A1A2E;
  --bg2: #16213E;
  --panel: #0F1530;
  --fill: #0F1530;     /* 채운 칸 (그림) */
  --empty: #F2F2F7;    /* 빈 칸 */
  --line: #2A2A44;
  --sel: #E9C46A;      /* 선택 행 강조 */
  --ok: #2A9D8F;       /* 충족 열 */
  --bad: #16213E;      /* 미충족 열 */
  --text: #EEEEEE;
  --muted: #9aa0b5;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  overscroll-behavior: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 14px 14px max(14px, env(safe-area-inset-bottom));
}

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0;
}
.logo span { color: var(--sel); }
.puzzle-label {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  color: var(--muted);
}

.status {
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  margin: 8px 4px 12px;
  min-height: 21px;
  color: var(--text);
}
.status.solved { color: var(--sel); font-weight: 700; }

.progress-wrap {
  position: relative;
  height: 22px;
  background: var(--panel);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 4px 16px;
  border: 1px solid var(--line);
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2A9D8F, #4ecdc4);
  border-radius: 999px;
  transition: width .35s cubic-bezier(.4,0,.2,1);
}
.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

.board-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
#board {
  display: block;
  touch-action: none;
  max-width: 100%;
  border-radius: 8px;
}

.controls {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.btn {
  flex: 1;
  padding: 14px 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: transform .08s, background .15s;
  font-family: inherit;
}
.btn:active { transform: scale(.96); background: #1d2b4d; }
.btn-primary {
  background: var(--sel);
  color: #1A1A2E;
  border-color: var(--sel);
}

/* 승리 오버레이 */
.win-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 26, .72);
  backdrop-filter: blur(3px);
  border-radius: 8px;
  z-index: 5;
  animation: fadeIn .25s ease;
}
.win-overlay.hidden { display: none; }
.win-card {
  text-align: center;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 32px;
  animation: pop .35s cubic-bezier(.2,1.3,.4,1);
}
.win-emoji { font-size: 56px; line-height: 1; }
.win-title { font-size: 26px; font-weight: 800; margin-top: 8px; color: var(--sel); }
.win-sub { font-size: 14px; color: var(--muted); margin: 6px 0 18px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
