/* © 2026 pluvius.dev. All rights reserved. */
/* Shared theme & app-shell primitives for all PuzzleSuite games. */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #1c2333;
  --text-dim: #6b7280;
  --border: #d8dee9;
  --cell-given: #1c2333;
  --cell-user: #3461eb;
  --cell-selected: #cfe0ff;
  --cell-peer: #e8edf9;
  --cell-same: #d3e0fc;
  --cell-conflict: #ffd7d7;
  --cell-conflict-text: #d92626;
  --accent: #4f7cff;
  --accent-text: #ffffff;
  --box-border: #33415c;
  --shadow: 0 2px 10px rgba(20, 30, 60, 0.08);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #12151f;
  --surface: #1b202e;
  --text: #e7ebf5;
  --text-dim: #9aa4b8;
  --border: #2c3346;
  --cell-given: #e7ebf5;
  --cell-user: #7fa2ff;
  --cell-selected: #2c3f6e;
  --cell-peer: #232a3d;
  --cell-same: #2d3f66;
  --cell-conflict: #4a2130;
  --cell-conflict-text: #ff8080;
  --accent: #5b86ff;
  --accent-text: #ffffff;
  --box-border: #aab6d4;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151f;
    --surface: #1b202e;
    --text: #e7ebf5;
    --text-dim: #9aa4b8;
    --border: #2c3346;
    --cell-given: #e7ebf5;
    --cell-user: #7fa2ff;
    --cell-selected: #2c3f6e;
    --cell-peer: #232a3d;
    --cell-same: #2d3f66;
    --cell-conflict: #4a2130;
    --cell-conflict-text: #ff8080;
    --accent: #5b86ff;
    --accent-text: #ffffff;
    --box-border: #aab6d4;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 8px;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.logo-link {
  text-decoration: none;
  color: inherit;
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary-btn {
  flex: 1;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.text-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  padding: 8px;
  cursor: pointer;
  width: 100%;
}

.foot {
  text-align: center;
  padding-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
  min-height: 18px;
}

.foot .credit {
  margin-top: 2px;
}

.brand-line {
  color: var(--text-dim);
  font-size: 12px;
  margin: -4px 0 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal.hidden { display: none; }

.modal-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 24px 20px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: var(--shadow);
}

.modal-card h2 { margin: 0 0 6px; }
.modal-sub { color: var(--text-dim); font-size: 13px; margin: 0 0 16px; }

@media (min-width: 500px) {
  .app { padding-top: 24px; }
}
