:root {
  /* Darker, richer yellow background + dark green buttons */
  --bg: #FFD24C;             /* vibrant golden yellow */
  --panel: #ffffff;
  --ink: #0b1320;
  --muted: #5b6270;
  --accent: #2F855A;         /* green-700 */
  --accent-ink: #ffffff;
  --danger: #e11d48;         /* rose-600 */
  --good: #059669;           /* emerald-600 */

  --border: #e5e7eb;
  --shadow: 0 6px 18px rgba(17, 24, 39, 0.06);

  /* FAB sizing */
  --fab-size: 64px;    /* was 56px */
  --fab-gap: 12px;     /* space between FAB and its menu (was ~10px) */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;            /* better mobile scrolling/tapping */
}

/* Hide the page for a split-second until the first view renders */
html.app-booting body { visibility: hidden; }

.wrap { max-width: 960px; margin: 16px auto 24px; padding: 12px; }

/* App title: solid white with darker, deeper shadow for yellow BG */
h1#appTitle {
  text-align: center;
  font-weight: 900;
  font-size: clamp(1.6rem, 2.5vw + 1rem, 2.6rem);
  line-height: 1.2;
  margin: 12px 0 16px;

  color: #fff;
  text-shadow:
    0 2px 2px rgba(0, 0, 0, 0.45),       /* tighter core shadow */
    0 8px 20px rgba(0, 0, 0, 0.4);       /* deeper ambient layer */
  -webkit-text-stroke: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;

  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial,
               "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", sans-serif;
}

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
  /* keep overflow visible so dropdowns/menus aren't clipped */
  overflow: visible;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.col { flex: 1 1 240px; min-width: 220px; }

label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 6px; }

/* Inputs & buttons */
input, select, button {
  width: 100%;
  height: 44px; /* bigger tap target */
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--ink);
  font-size: 16px; /* prevent iOS zoom on focus */
}
input[type=number] { appearance: textfield; }

input:focus, select:focus, button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

button { background: #f3f4f6; cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); border: none; font-weight: 700; }
button.ghost { background: #ffffff; border: 1px solid var(--border); }
button:disabled, .btn-disabled { opacity: .6; cursor: not-allowed; }

/* Differentiate the inputs in each player card */
.name-input {
  background: #f3f4f6;               /* light gray */
  border-color: var(--border);
}
.name-input:disabled {
  background: #f3f4f6;
  border-color: var(--border);
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  opacity: 1;
}
.name-input:focus { background: #eef2f7; }
.score-input { background: #ffffff; }

/* Grid blocks */
.grid { display: grid; gap: 8px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) {
  .grid.cols-2 { grid-template-columns: 1fr; }
}

/* Players list becomes a grid of cards */
.players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}
@media (max-width: 640px) {
  .players { grid-template-columns: 1fr; }
}

/* Player card styling (base) */
.player-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px;
}

/* Pills & badges */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--border);
  font-size: .9rem;
}
.pill .slash { opacity: .6; padding: 0 2px; }
.pill-lg { padding: 8px 12px; font-size: 1rem; font-weight: 700; }

.badge {
  display: inline-block; padding: 6px 10px; border-radius: 10px; font-size: .9rem;
  background: #f8fafc; border: 1px solid var(--border); color: var(--muted);
}

/* Status row (Play screen) */
.status-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.status-block { flex: 1 1 200px; min-width: 180px; }
.status-label { font-size: .95rem; color: var(--muted); margin-bottom: 6px; }

@media (max-width: 520px) {
  .status-row { gap: 6px; flex-wrap: nowrap; }
  .status-block { min-width: 0; flex: 1 1 0; }
  .pill-lg { padding: 7px 10px; font-size: .98rem; }
  .status-label { font-size: .9rem; }
}

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--border); padding: 10px; text-align: left; }
td.right { text-align: right; }
th.right { text-align: right; }

/* Status colors */
.pos { color: var(--good); font-weight: 600; }
.neg { color: var(--danger); font-weight: 600; }
.muted { color: var(--muted); }

/* Section titles (centered & larger) */
.section-title {
  text-align: center;
  font-weight: 700;
  color: #111827;
  font-size: clamp(1.1rem, 0.7vw + 1rem, 1.35rem);
  margin: 16px 0 10px;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.small { font-size: .95rem; }

.history {
  max-height: 320px; overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.flex-between { display: flex; justify-content: space-between; align-items: center; }

@media (max-width: 640px) {
  .wrap { padding: 10px; }
  .card { padding: 12px; }
}

/* ----- Hole Result page only: center everything horizontally ----- */
.hole-center { text-align: center; }
.hole-center .section-title,
.hole-center .badge,
.hole-center .small { text-align: center; }

/* Center lists as a block but keep item text readable */
.hole-center .hole-list {
  display: inline-block;
  text-align: left;
  list-style-position: inside;
  margin: 6px 0 0 0;
  padding: 0;
}

/* ----- Center ONLY the Current Hole / Current Multiplier chips ----- */
.status-row { justify-content: center; }
.status-block { text-align: center; }
.status-block .pill { display: inline-flex; }

/* Force single-column vertical stack for Play page players (true tee order) */
.players--stack { grid-template-columns: 1fr !important; }

/* Small margin helper for Setup title row */
.mb-12 { margin-bottom: 12px; }

/* --- FAB (Floating Action Button) --- */
.card-has-fab { position: relative; }

.fab {
  position: fixed;
  bottom: 16px;
  left: auto;
  right: var(--fab-right, 16px);
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.35), 0 4px 10px rgba(0,0,0,0.12);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* --- FAB inline menu --- */
.fab-menu {
  position: fixed;
  right: var(--fab-right, 16px);
  bottom: calc(16px + var(--fab-size) + var(--fab-gap));
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 1001;
  max-width: 92vw;

  /* IMPORTANT: ignore taps when hidden */
  pointer-events: none;
}
.fab-menu.show {
  display: flex;
  pointer-events: auto;  /* interactive only when visible */
}
.fab-menu button {
  height: 48px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  font-size: 1.05rem;
}
.fab-menu button:hover { background: #eef2f7; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1100;

  /* IMPORTANT: don't block page when not shown */
  pointer-events: none;
}
.modal-overlay.show {
  display: flex;
  pointer-events: auto; /* overlay captures clicks only when visible */
}

.modal-card {
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px;
  display: flex;
  flex-direction: column;
}
.modal-header { margin-bottom: 8px; }
.modal-body {
  overflow: auto;
  flex: 1 1 auto;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;  /* smooth iOS scroll in modal */
}
.modal-actions { display: flex; justify-content: center; gap: 8px; }
body.no-scroll { overflow: hidden; height: 100vh; }

/* allow a second row of buttons in modals */
.modal-actions { 
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;              /* <— lets the 3rd button drop below */
}

/* full-width, red danger button */
.modal-actions .btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
}
.modal-actions .btn-full {
  flex: 1 1 100%;               /* take the whole row */
}

/* Welcome page centering + logo */
.welcome-card { text-align: center; }
.welcome-logo {
  display: block;
  margin: 4px auto 10px;
  width: clamp(220px, 44vw, 420px);
  height: auto;
  pointer-events: none;
  user-select: none;
}

/* Pink accent for multiplier number */
.pink { color: #ff2d55; }

/* --- Toggle rows styled like inputs --- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  height: 44px;
  margin-top: 10px;
}
.toggle-label { font-size: .95rem; color: var(--ink); font-weight: 600; }

/* --- iOS-style switch (solid red/green) --- */
.switch { position: relative; display: inline-block; width: 52px; height: 28px; }
.switch input { display: none; }
.slider {
  position: absolute; inset: 0;
  background: #ef4444;            /* solid red when OFF */
  border-radius: 999px;
  transition: background .2s ease;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
  border: none;
}
.slider:before {
  content: "";
  position: absolute;
  height: 22px; width: 22px;
  left: 3px; top: 50%; transform: translateY(-50%);
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  transition: transform .2s ease;
}
.switch input:checked + .slider { background: #16a34a; }
.switch input:checked + .slider:before { transform: translate(24px, -50%); }
.switch input:focus + .slider {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2), inset 0 0 0 1px rgba(0,0,0,.06);
}

/* Soft pink pill (for the Current Multiplier) */
.pill-soft-pink {
  background: #fff1f5;   /* very light pink */
  border-color: #ffd1e1; /* subtle pink border */
}

/* ---------------- Extra tweaks you requested ---------------- */

/* Stronger player-card border (more noticeable) */
.player-card {
  border: 2px solid #d1d5db !important; /* gray-300, stronger than default */
}

/* Role label styling: Honor full color, others slightly darker (not washed out) */
.player-card .role-label {
  font-weight: 800;
  font-size: .95rem;
}
.player-card .role-label.honor {
  color: var(--ink);      /* full color */
}
.player-card .role-label.other {
  color: #4b5563; 
}

/* Mobile-friendly, high-contrast expand/collapse buttons */
.expand-btn {
  border: 1px solid #111827;   /* thicker, nearly black border */
  background: #ffffff;         /* solid white for contrast on yellow bg */
  color: #111827;              /* dark text */
  font-weight: 700;            /* bolder label */
  border-radius: 10px;         /* matches your UI */
  padding: 12px 14px;          /* comfy tap target */
}

button.ghost.expand-btn { border-color: #111827; }

.expand-btn:hover {
  border-color: #111827;          /* almost black on hover */
  background: #f3f4f6;            /* subtle hover fill */
}

/* End-of-round reconciliations table: equal column widths */
.recon-table { table-layout: fixed; width: 100%; }
.recon-table th, .recon-table td { overflow-wrap: anywhere; }

/* Strong outline for 'View' buttons in Reconciliations table */
.recon-table button.ghost {
  border: 2px solid #4b5563;  /* darker gray-600 */
  color: #111827;
  background: #fff;
}

/* Make all ghost buttons inside modals a bit stronger */
.modal-actions .ghost {
  border-color: #9ca3af;      /* slate-400 */
}

/* Extra-strong outline just for Accumulate */
.btn-outline-strong {
  border-color: #374151 !important;  /* slate-700 */
  border-width: 1px !important;
}
