:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface2: #f1f5f9;
  --border: #e2e8f0;
  --border2: #cbd5e1;
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --accent: #2563eb;
  --accent-dim: rgba(37,99,235,0.08);
  --accent-dim2: rgba(37,99,235,0.04);
  --red: #dc2626;
  --red-dim: rgba(220,38,38,0.08);
  --amber: #b45309;
  --amber-dim: rgba(180,83,9,0.08);
  --blue: #2563eb;
  --blue-dim: rgba(37,99,235,0.08);
  --radius: 8px;
  --radius2: 12px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 14px;
}

/* ── LOAD SCREEN ── */
#load-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.load-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  width: 100%;
  max-width: 560px;
  overflow: hidden;
}

.load-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(37,99,235,0.2);
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.load-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.load-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }

.load-option-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 6px;
}

/* File drop zone */
.drop-zone {
  border: 1px dashed var(--border2);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: rgba(37,99,235,0.3);
  background: var(--accent-dim2);
}

.drop-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}

.drop-icon { font-size: 24px; margin-bottom: 8px; opacity: 0.5; }

.drop-text { font-size: 13px; color: var(--text2); }
.drop-sub { font-size: 11px; color: var(--text3); margin-top: 4px; }

.divider-or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text3);
  font-size: 11px;
  font-family: 'DM Mono', monospace;
}

.divider-or::before, .divider-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Paste textarea */
.paste-area {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text2);
  padding: 12px;
  resize: vertical;
  min-height: 90px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
  line-height: 1.5;
}

.paste-area:focus { border-color: rgba(37,99,235,0.3); color: var(--text); }
.paste-area::placeholder { color: var(--text3); }

.load-actions { display: flex; gap: 8px; justify-content: flex-end; }

.btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn:hover { background: var(--border); color: var(--text); }

.btn-primary {
  background: var(--accent-dim);
  border-color: rgba(37,99,235,0.2);
  color: var(--accent);
}

.btn-primary:hover { background: rgba(37,99,235,0.15); }

.btn-save {
  background: var(--accent-dim);
  border-color: rgba(37,99,235,0.2);
  color: var(--accent);
}

.btn-save:hover { background: rgba(37,99,235,0.15); }

.error-msg {
  background: var(--red-dim);
  border: 1px solid rgba(220,38,38,0.2);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 12px;
  padding: 8px 12px;
  display: none;
}

/* ── EDITOR (hidden until loaded) ── */
#editor { display: none; flex: 1; flex-direction: column; overflow: hidden; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  gap: 16px;
}

.header-left { display: flex; align-items: center; gap: 12px; }
.round-title { font-size: 16px; font-weight: 600; color: var(--text); }
.round-meta { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text3); }
.header-right { display: flex; align-items: center; gap: 8px; }

.layout {
  display: grid;
  grid-template-columns: 390px 1fr;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-section { padding: 12px; border-bottom: 1px solid var(--border); }

.sidebar-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 0 4px;
  margin-bottom: 6px;
}

.round-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }

.info-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
}

.info-chip .label { font-size: 10px; color: var(--text3); margin-bottom: 2px; }
.info-chip .value { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 500; color: var(--text); }
.info-chip.score-chip .value { font-size: 18px; color: var(--amber); }

.hole-list { padding: 4px 8px; flex: 1; }
.hole-row:last-child { border-bottom-color: transparent; }

.hole-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.12s;
  margin-bottom: 0;
  border: 1px solid transparent;
  border-bottom-color: var(--border);
  position: relative;
  overflow: hidden;
}

.hole-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
}

.hole-row:hover { background: var(--surface2); }
.hole-row.active    { background: var(--accent-dim2); border-color: rgba(37,99,235,0.15); }
.hole-row.tee-unsafe::before { background: rgba(251,191,36,0.9); }
.hole-row.tee-gir::before    { background: rgba(22,163,74,0.85); }

.hole-num {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  width: 18px;
  text-align: right;
  flex-shrink: 0;
}

.hole-row.active .hole-num { color: var(--accent); }

.hole-bar { flex: 1; display: flex; flex-direction: column; gap: 2px; }

.hole-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.par-badge { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--text3); }

.hole-shots-preview {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-badge {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 26px;
  text-align: center;
}

.score-eagle  { background: rgba(124,58,237,0.08); color: #6d28d9;       border: 1px solid rgba(124,58,237,0.2); }
.score-birdie { background: var(--accent-dim);      color: var(--accent); border: 1px solid rgba(37,99,235,0.2); }
.score-par    { background: var(--surface2);        color: var(--text2);  border: 1px solid var(--border); }
.score-bogey  { background: var(--amber-dim);       color: var(--amber);  border: 1px solid rgba(180,83,9,0.2); }
.score-double { background: var(--red-dim);         color: var(--red);    border: 1px solid rgba(220,38,38,0.2); }
.score-worse  { background: rgba(185,28,28,0.08);   color: #991b1b;       border: 1px solid rgba(185,28,28,0.25); }

.detail {
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.panel-title {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title .hole-indicator {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0;
  text-transform: none;
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1px;
  background: var(--border);
}

.fields-row {
  display: flex;
  overflow-x: auto;
  background: var(--border);
  gap: 1px;
}
.fields-row > .field { flex: 1 0 72px; }

.field {
  background: var(--surface);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.field label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
}

.field input, .field select {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  padding: 0;
  transition: color 0.1s;
}

.field input:focus, .field select:focus { color: var(--accent); }
.field input[type="number"] { -moz-appearance: textfield; }
.field input[type="number"]::-webkit-inner-spin-button { display: none; }
.field select { cursor: pointer; }
.field select option { background: var(--surface2); }

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

.shots-table th {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 8px 12px;
  text-align: left;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-weight: 400;
}

.shots-table td { padding: 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.shots-table tr:last-child td { border-bottom: none; }
.shots-table tr:hover td { background: var(--surface2); }

.shot-num {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text3);
  padding: 10px 12px;
  width: 32px;
  text-align: center;
  background: var(--surface2);
  border-right: 1px solid var(--border);
}

.td-input {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 12px;
  width: 100%;
  transition: all 0.1s;
}

.td-input:focus { color: var(--accent); background: var(--accent-dim2); }

.td-delete { padding: 0 10px; opacity: 0; transition: opacity 0.1s; }
.shots-table tr:hover .td-delete { opacity: 1; }

.del-btn {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

.del-btn:hover { background: var(--red-dim); }

.add-shot-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.add-shot-input {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 10px;
  outline: none;
  width: 140px;
  transition: border-color 0.1s;
}

.add-shot-input:focus { border-color: rgba(37,99,235,0.3); }
.add-shot-input::placeholder { color: var(--text3); }

.add-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(37,99,235,0.2);
  background: var(--accent-dim);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s;
}

.add-btn:hover { background: rgba(37,99,235,0.15); }

.putting-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px; }

.putt-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 6px;
}

.putt-chip input {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  width: 36px;
  -moz-appearance: textfield;
}

.putt-chip input::-webkit-inner-spin-button { display: none; }
.putt-chip input:focus { color: var(--accent); }
.putt-chip .del-btn { font-size: 11px; color: var(--text3); padding: 2px; }

.boolean-toggle { display: flex; gap: 4px; }

.toggle-btn {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  transition: all 0.12s;
}

.toggle-btn.on { background: var(--accent-dim); border-color: rgba(37,99,235,0.2); color: var(--accent); }
.toggle-btn.off-red { background: var(--red-dim); border-color: rgba(220,38,38,0.2); color: var(--red); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  color: var(--text3);
}

.empty-state .arrow { font-size: 24px; opacity: 0.4; }
.empty-state p { font-size: 13px; }

/* file source badge */
.source-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(37,99,235,0.2);
  background: rgba(37,99,235,0.06);
  color: var(--blue);
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--surface2);
  border: 1px solid rgba(37,99,235,0.2);
  color: var(--accent);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  padding: 10px 16px;
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s;
  pointer-events: none;
  z-index: 100;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(220,38,38,0.2); color: var(--red); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }
