:root {
  color-scheme: dark;
  --bg: #0b1120;
  --panel: #111827;
  --panel-soft: #172033;
  --panel-strong: #1e293b;
  --text: #f8fafc;
  --muted: #a8b3c7;
  --line: #26344d;
  --accent: #38bdf8;
  --accent-strong: #0284c7;
  --good: #34d399;
  --bad: #fb7185;
  --button: #24324a;
  --shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 34rem),
    linear-gradient(180deg, #0f172a 0%, #0b1120 48%, #090d18 100%);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 16px 14px calc(32px + env(safe-area-inset-bottom));
}

.hero {
  padding: 18px 4px 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(1.8rem, 8vw, 2.45rem);
  line-height: 1.05;
}

.hero-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.card {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(17, 24, 39, 0.92);
  box-shadow: var(--shadow);
}

.card h2 {
  margin-bottom: 12px;
  font-size: 1.08rem;
}

.section-head,
.ticket-group-head,
.entrance-title-row,
.formation-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head h2,
.entrance-title-row h3,
.ticket-group-head h3 {
  margin-bottom: 0;
}

.hint,
.count-badge {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.count-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.13);
  color: #bae6fd;
  font-weight: 800;
}

.input-grid,
.entrance-grid,
.boat-list,
.summary-grid,
.formation-rows,
.ticket-groups {
  display: grid;
  gap: 12px;
}

.input-grid,
.entrance-grid {
  margin-top: 12px;
}

label span,
.memo-label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  background: #0f172a;
  color: var(--text);
  outline: none;
}

input {
  min-height: 48px;
}

textarea {
  min-height: 86px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.entrance-box,
.boat-card,
.ticket-group {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
}

.entrance-display {
  min-width: 7em;
  padding: 8px 10px;
  border-radius: 12px;
  background: #0f172a;
  color: var(--good);
  text-align: center;
  letter-spacing: 0.06em;
}

.entrance-buttons,
.choice-group,
.number-group,
.decision-buttons,
.development-buttons {
  display: grid;
  gap: 8px;
}

.entrance-buttons {
  grid-template-columns: repeat(4, 1fr);
  margin-top: 10px;
}

.entrance-buttons button,
.choice-button,
.number-button,
.decision-buttons button,
.development-button,
.group-clear {
  min-height: 46px;
  border-radius: 13px;
  background: var(--button);
  color: var(--text);
  font-weight: 900;
}

.entrance-buttons .clear-mini,
.utility-button,
.group-clear {
  background: #334155;
  color: #dbeafe;
  font-size: 0.88rem;
}

.boat-list {
  margin-top: 12px;
}

.boat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 900;
}

.boat-number {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--panel-strong);
  color: #e0f2fe;
  font-size: 1.2rem;
}

.eval-row {
  display: grid;
  grid-template-columns: 4.8em 1fr;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.eval-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.choice-group {
  grid-template-columns: repeat(4, 1fr);
}

.choice-button.active,
.number-button.active,
.development-button.active {
  background: var(--accent-strong);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.choice-button[data-value="◎"].active {
  background: #047857;
}

.choice-button[data-value="○"].active {
  background: #0369a1;
}

.choice-button[data-value="△"].active {
  background: #b45309;
}

.choice-button[data-value="×"].active {
  background: #be123c;
}

.summary-grid h3 {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-text {
  min-height: 42px;
  margin-bottom: 0;
  padding: 12px;
  border-radius: 14px;
  background: #0f172a;
  font-weight: 800;
  line-height: 1.45;
}

.development-buttons {
  grid-template-columns: repeat(2, 1fr);
  margin-top: 12px;
}

.memo-label {
  display: block;
  margin-top: 12px;
}

.decision-buttons {
  grid-template-columns: repeat(3, 1fr);
}

.decision-buttons button {
  min-height: 58px;
  font-size: 1.1rem;
}

.decision-buttons button.active[data-decision="buy"] {
  background: #047857;
}

.decision-buttons button.active[data-decision="watch"] {
  background: #475569;
}

.decision-buttons button.active[data-decision="hold"] {
  background: #b45309;
}

.ticket-groups {
  margin-top: 14px;
}

.ticket-group {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(23, 32, 51, 0.96));
}

.ticket-group-head {
  align-items: flex-start;
}

.ticket-group-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.group-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.group-clear {
  min-height: 36px;
  padding: 0 10px;
}

.formation-rows {
  margin-top: 14px;
}

.formation-row-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 900;
}

.number-group {
  grid-template-columns: repeat(4, 1fr);
}

.number-button {
  min-height: 50px;
  font-size: 1.08rem;
}

.budget-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}

.per-ticket {
  min-height: 76px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #0f172a;
}

.per-ticket span,
.per-ticket small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.per-ticket strong {
  display: block;
  margin: 2px 0;
  color: var(--good);
  font-size: 1.35rem;
}

.ticket-list-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ticket-list.empty {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: #0f172a;
  color: var(--muted);
  font-weight: 700;
}

.ticket-chip {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0f172a;
  font-weight: 900;
}

.danger-zone {
  padding: 16px 0 4px;
}

.reset-button {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(251, 113, 133, 0.45);
  border-radius: 16px;
  background: rgba(251, 113, 133, 0.14);
  color: #fecdd3;
  font-weight: 900;
}

@media (min-width: 480px) {
  .input-grid,
  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
