:root {
  --bg: #e8eaee;
  --bg-urgent: #efe6e1;
  --card: #ffffff;
  --line: #d5d9e0;
  --text: #1f2933;
  --muted: #667085;
  --blue: #2f6fed;
  --blue-press: #1f54c8;
  --danger: #c2410c;
  --danger-bg: #fff4ed;
  --ok: #15803d;
  --warn: #b45309;
  --bar: #dfe4ea;
  --shadow: 0 8px 24px rgba(31, 41, 51, 0.08);
  --radius: 12px;
  --font: "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

body.is-urgent {
  background: var(--bg-urgent);
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.screen-center {
  min-height: calc(100vh - 32px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.start-card,
.result-card {
  width: min(520px, 100%);
  text-align: center;
  padding: 28px 24px 24px;
}

.brand-mark {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 18px;
}

.title {
  font-size: clamp(28px, 6vw, 36px);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 28px;
}

.start-copy {
  margin-bottom: 28px;
  color: #344054;
}

.btn {
  appearance: none;
  touch-action: manipulation;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  min-height: 44px;
}

.btn:hover {
  background: #eef2f6;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--blue-press);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: #fff;
}

.btn-lg {
  min-width: 180px;
  min-height: 52px;
  font-size: 16px;
}

.btn-small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
}

.btn-feature {
  background: #fff;
}

.btn-feature.is-selected {
  background: #eaf1ff;
  border-color: var(--blue);
  color: var(--blue);
}

.game-shell {
  display: grid;
  gap: 12px;
  padding-bottom: 24px;
}

.hud-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.hud-item {
  background: #f7f8fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
}

.hud-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 2px;
}

.hud-value {
  font-size: 20px;
  font-weight: 700;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.hud-value.is-urgent {
  color: var(--danger);
  animation: pulse 0.9s ease-in-out infinite;
}

.hud-value.is-low {
  color: var(--danger);
}

.hud-value.is-drop {
  color: var(--danger);
}

.hud-value.is-up {
  color: var(--ok);
}

.mental-quote {
  margin-top: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.card-head h2,
.app-card h2 {
  font-size: 15px;
  font-weight: 700;
}

.initial-spec,
.hint,
.empty-dev {
  color: var(--muted);
  font-size: 12px;
}

.feature-list,
.pending-list {
  list-style: none;
}

.feature-row {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  grid-template-areas:
    "dot name meta"
    "dot bar bar";
  gap: 2px 8px;
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
}

.feature-row + .feature-row {
  border-top: 1px solid #eef1f5;
}

.feature-row.is-active {
  background: #eef4ff;
}

.feature-row.is-done {
  background: #f3faf4;
}

.feature-dot {
  grid-area: dot;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
  background: #c5cdd6;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.feature-dot.is-progress {
  background: #eab308;
}

.feature-dot.is-done {
  background: #22c55e;
}
.feature-name { grid-area: name; font-weight: 650; }
.feature-meta { grid-area: meta; color: var(--muted); font-size: 13px; }
.bar { grid-area: bar; }

.bar {
  height: 8px;
  background: var(--bar);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #3b82f6, #22c55e);
  transition: width 80ms linear;
}

.feature-fx {
  position: absolute;
  right: 12px;
  top: 0;
  pointer-events: none;
}

.dev-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pending-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.warn-mark {
  color: var(--warn);
}

.pending-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0 0;
  font-size: 13px;
}

.pending-text {
  color: #475467;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}

.overlay-solid {
  background: rgba(248, 250, 252, 0.96);
  z-index: 30;
}

.modal {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 24px 20px 20px;
  animation: popIn 180ms ease-out;
}

.modal.is-major {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.modal-kicker {
  font-weight: 800;
  margin-bottom: 12px;
}

.modal-body {
  white-space: pre-wrap;
  margin-bottom: 20px;
  min-height: 48px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.deadline-text {
  font-size: clamp(36px, 10vw, 64px);
  font-weight: 800;
  letter-spacing: 0.08em;
  animation: popIn 220ms ease-out;
}

.countdown-fx {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: 28vw;
  font-weight: 900;
  color: rgba(194, 65, 12, 0.18);
  z-index: 15;
}

.countdown-fx.pop {
  animation: countPop 0.45s ease-out;
}

.toast-fx {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: grid;
  gap: 8px;
}

.toast {
  background: #111827;
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  animation: fadeUp 1s ease-out forwards;
}

.float-fx {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  animation: fadeUp 0.9s ease-out forwards;
}

.float-fx.ok { color: var(--ok); }
.float-fx.bad { color: var(--danger); }

.result-stats {
  text-align: left;
  margin: 4px auto 10px;
  width: min(320px, 100%);
}

.result-stats > div {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}

.result-title {
  font-size: 20px;
  font-weight: 800;
  margin: 6px 0;
}

.result-kicker {
  color: var(--muted);
  letter-spacing: 0.08em;
}

.punchline {
  white-space: pre-wrap;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.7;
  padding: 28px 8px;
}

.game-end {
  margin-top: 12px;
}

.game-end p {
  margin-bottom: 12px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.result-echo {
  letter-spacing: 0 !important;
  color: var(--text) !important;
  font-weight: 700;
  margin-bottom: 18px !important;
}

@keyframes pulse {
  50% { opacity: 0.55; }
}

@keyframes popIn {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes countPop {
  from { transform: scale(0.7); opacity: 0.2; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes fadeUp {
  0% { transform: translateY(6px); opacity: 1; }
  100% { transform: translateY(-16px); opacity: 0; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

body.shake {
  animation: shake 0.45s linear;
}

body.dimmed #screen-game {
  filter: brightness(0.86);
}

body[data-mental="mid"] .mental-quote {
  letter-spacing: 0.02em;
}

body[data-mental="low"] .card {
  transform: rotate(-0.35deg);
}

body[data-mental="low"] .btn-feature:nth-child(odd) {
  transform: rotate(0.8deg);
}

body[data-mental="critical"] .card {
  transform: rotate(0.6deg);
}

body[data-mental="critical"] .hud-value {
  font-family: Georgia, serif;
}

body[data-mental="critical"] .btn {
  transform: rotate(-1.2deg);
}

body[data-mental="zero"] .card {
  transform: rotate(-1deg);
  border-style: dashed;
}

body[data-mental="zero"] .mental-quote {
  font-size: 28px;
  color: #111;
}

body[data-mental="zero"] .btn-danger {
  letter-spacing: 0.3em;
}

@media (max-width: 640px) {
  #app { padding: 10px; }
  .hud-row { grid-template-columns: repeat(2, 1fr); }
  .hud-value { font-size: 18px; }
  .card-head { flex-direction: column; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }
  .start-card, .result-card { padding: 28px 18px; }
}

@media (max-height: 800px) {
  .result-card { padding: 20px 18px; }
  .result-kicker { display: none; }
}
