﻿:root {
  --bg: #f4efe6;
  --paper: #fffdf9;
  --paper-strong: #ffffff;
  --ink: #1f2430;
  --muted: #6d7280;
  --accent: #c96e3d;
  --accent-deep: #99461b;
  --accent-soft: #f4d8c8;
  --success: #2f7d57;
  --danger: #b84545;
  --line: rgba(31, 36, 48, 0.12);
  --shadow: 0 22px 55px rgba(67, 40, 20, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(201, 110, 61, 0.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(84, 145, 119, 0.18), transparent 28%),
    linear-gradient(160deg, #f6f0e4 0%, #efe6d6 55%, #f8f2e8 100%);
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.eyebrow,
.kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: var(--accent-deep);
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-family: "Instrument Serif", serif;
  font-size: clamp(2.3rem, 5vw, 4.8rem);
  line-height: 0.95;
  font-weight: 400;
}

.hero-copy {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.layout {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.panel {
  grid-column: span 12;
  background: rgba(255, 253, 249, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 24px;
}

.panel-accent {
  background:
    linear-gradient(135deg, rgba(201, 110, 61, 0.12), transparent 30%),
    rgba(255, 253, 249, 0.92);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.stack-lg {
  display: grid;
  gap: 20px;
}

.player-grid,
.round-grid,
.score-grid {
  display: grid;
  gap: 16px;
}

.player-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.round-grid {
  grid-template-columns: 1fr;
}

.score-grid,
.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field {
  display: grid;
  gap: 8px;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 700;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
}

input:focus,
select:focus,
button:focus {
  outline: 3px solid rgba(201, 110, 61, 0.25);
  outline-offset: 2px;
}

.target-picker {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.target-card {
  position: relative;
}

.target-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.target-card span,
.pill,
.ghost-button,
.primary-button {
  border-radius: 999px;
}

.target-card span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  font-weight: 700;
  cursor: pointer;
}

.target-card input:checked + span {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.primary-button,
.ghost-button {
  border: 0;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  font-weight: 700;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  border: 1px solid var(--line);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.danger-button {
  background: linear-gradient(135deg, #cd5346, #9f2d2f);
}

.danger-text {
  color: var(--danger);
}

.pill-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  padding: 8px 12px;
  font-size: 0.85rem;
  background: rgba(201, 110, 61, 0.12);
  color: var(--accent-deep);
  font-weight: 700;
}

.score-card,
.round-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 20px;
  padding: 18px;
}

.score-card.leader {
  background: linear-gradient(160deg, rgba(201, 110, 61, 0.16), rgba(255, 255, 255, 0.98));
  border-color: rgba(201, 110, 61, 0.35);
}

.score-card.winner {
  background: linear-gradient(160deg, rgba(47, 125, 87, 0.2), rgba(255, 255, 255, 0.98));
  border-color: rgba(47, 125, 87, 0.35);
}

.score-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.score-total {
  font-size: 2rem;
  font-weight: 700;
}

.score-note {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 8px;
}

.round-meta {
  grid-column: 1 / -1;
  margin-top: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.round-card-grid {
  grid-column: 1 / -1;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.round-card {
  display: grid;
  gap: 12px;
}

.inline-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 4px;
  border-radius: 16px;
  background: rgba(31, 36, 48, 0.06);
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: block;
  text-align: center;
  padding: 10px 8px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

.segmented input:checked + span {
  background: white;
  box-shadow: 0 4px 14px rgba(31, 36, 48, 0.08);
}

.form-actions,
.signature-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.table-wrap {
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th,
.history-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.history-table th {
  color: var(--muted);
  font-size: 0.85rem;
}

.history-table td strong {
  display: block;
}

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

.mini-button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 7px 10px;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.signature-block {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
  align-items: start;
}

.signature-pad-wrap {
  display: grid;
  gap: 10px;
}

#signature-canvas {
  width: 100%;
  min-height: 180px;
  border-radius: 18px;
  border: 1px dashed rgba(31, 36, 48, 0.25);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 239, 230, 0.8));
  touch-action: none;
}

.signature-status {
  color: var(--muted);
  font-size: 0.92rem;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(20, 16, 12, 0.35);
}

.dialog-card {
  width: min(420px, calc(100vw - 32px));
  padding: 24px;
  border-radius: 24px;
  background: white;
  box-shadow: var(--shadow);
}

.empty-state {
  color: var(--muted);
}

@media (max-width: 840px) {
  .hero,
  .panel-heading,
  .signature-block {
    grid-template-columns: 1fr;
    display: grid;
  }

  .app-shell {
    width: min(100% - 20px, 1200px);
    padding-top: 20px;
  }

  .panel {
    padding: 18px;
  }
}

@media print {
  body {
    background: white;
  }

  .hero,
  #setup-panel,
  #round-panel,
  #history-panel,
  #restart-button,
  #print-button,
  .signature-actions,
  .ghost-button,
  .primary-button,
  dialog {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .panel {
    box-shadow: none;
    border: 1px solid #ddd;
    background: white;
  }
}




