:root {
  color-scheme: light;
  --ink: #142627;
  --muted: #5e7071;
  --line: #d8e2e1;
  --soft: #eef5f4;
  --paper: #f8fbfa;
  --surface: #ffffff;
  --teal: #0b4f52;
  --teal-bright: #0f6b69;
  --positive: #147057;
  --negative: #b8473b;
  --shadow: 0 16px 40px rgb(18 57 58 / 0.09);
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0%, rgb(89 172 161 / 0.14), transparent 30rem),
    var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(100% - 32px, 1180px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 34px 0 calc(42px + env(safe-area-inset-bottom));
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow, .section-kicker {
  margin: 0 0 7px;
  color: var(--teal-bright);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -0.06em; line-height: 1; }
h2 { margin-bottom: 0; font-size: 1.18rem; letter-spacing: -0.03em; }
.subtitle { max-width: 32rem; margin-bottom: 0; color: var(--muted); line-height: 1.65; }

.total-panel {
  display: grid;
  min-width: 172px;
  padding: 16px 18px;
  color: white;
  background: var(--teal);
  border-radius: 14px;
  box-shadow: 0 12px 24px rgb(11 79 82 / 0.2);
}
.total-panel span { font-size: 0.78rem; font-weight: 700; opacity: 0.8; }
.total-panel strong { margin: 2px 0; font-size: 2.25rem; letter-spacing: -0.06em; line-height: 1; }
.total-panel small { font-size: 0.78rem; opacity: 0.75; }

.add-person-section {
  display: flex;
  gap: 20px;
  align-items: end;
  justify-content: space-between;
  padding: 25px 0;
  border-bottom: 1px solid var(--line);
}

.add-person-form { display: flex; width: min(100%, 440px); gap: 10px; }
.import-section { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 1.35fr); gap: 14px 20px; align-items: center; padding: 22px 0; border-bottom: 1px solid var(--line); }
.import-score-form { display: grid; grid-template-columns: minmax(130px, 1fr) 132px auto; gap: 10px; }
.import-score-form input { padding: 0 13px; }
.import-score-form button { padding: 0 16px; color: white; background: var(--teal); }
.import-score-form button:hover { background: var(--teal-bright); }
.form-hint { grid-column: 2; margin: -5px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }
input {
  min-width: 0;
  min-height: 46px;
  border: 1px solid #b6c9c8;
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
}
input:focus { border-color: var(--teal-bright); box-shadow: 0 0 0 3px rgb(15 107 105 / 0.14); }
#person-name { flex: 1; padding: 0 13px; }

button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 800;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}
button:active { transform: translateY(1px) scale(0.985); }
.add-person-form button { min-height: 46px; padding: 0 18px; color: white; background: var(--teal); }
.add-person-form button:hover { background: var(--teal-bright); }

.status-message { min-height: 24px; margin: 13px 0 0; color: var(--negative); font-size: 0.9rem; font-weight: 700; }
.status-message.success { color: var(--positive); }

.match-section { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.match-section h2 { margin: 0; font-size: 1.2rem; }
.match-status { max-width: 680px; margin: 7px 0 0; color: var(--muted); font-size: 0.86rem; line-height: 1.55; overflow-wrap: anywhere; }
.match-actions { display: flex; flex: 0 0 auto; gap: 9px; }
.match-actions button { min-height: 44px; padding: 0 14px; color: white; background: var(--teal); white-space: nowrap; }
.match-actions .end-match { background: #8a5550; }
.match-actions button:disabled { cursor: not-allowed; opacity: 0.46; }
.match-history-section { padding: 4px 0 20px; border-bottom: 1px solid var(--line); }
.match-history-list { display: grid; gap: 9px; }
.match-history-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; background: var(--soft); border: 1px solid var(--line); border-radius: 11px; }
.match-history-item div { min-width: 0; }
.match-history-item strong, .match-history-item span { display: block; overflow-wrap: anywhere; }
.match-history-item span, .match-history-empty { margin: 4px 0 0; color: var(--muted); font-size: 0.8rem; }
.match-history-item button { flex: 0 0 auto; min-height: 40px; padding: 0 10px; color: var(--teal); background: white; border-color: #b6c9c8; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr); gap: 28px; padding-top: 12px; }
.workspace.workspace-single { grid-template-columns: minmax(0, 1fr); }
.people-section, .history-section { min-width: 0; }
.history-section { padding-left: 28px; border-left: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 17px 0; }
.people-toolbar { display: flex; align-items: center; justify-content: end; gap: 9px; flex-wrap: wrap; }
.people-filter { display: inline-flex; overflow: hidden; border: 1px solid #b6c9c8; border-radius: 9px; background: white; }
.filter-button { min-height: 38px; padding: 0 11px; color: var(--teal); background: transparent; border: 0; border-radius: 0; font-size: 0.78rem; white-space: nowrap; }
.filter-button + .filter-button { border-left: 1px solid #b6c9c8; }
.filter-button.is-active { color: white; background: var(--teal); }
.filter-button:hover:not(.is-active) { background: var(--soft); }
.summary-chip { padding: 5px 9px; color: var(--teal); background: var(--soft); border-radius: 999px; font-size: 0.8rem; font-weight: 800; white-space: nowrap; }
.result-button, .copy-button { min-height: 40px; padding: 0 10px; color: var(--teal); background: white; border-color: #b6c9c8; font-size: 0.78rem; white-space: nowrap; }
.result-button:hover, .copy-button:hover { border-color: var(--teal-bright); background: var(--soft); }
.daily-result { margin-bottom: 14px; padding: 13px; background: var(--soft); border: 1px solid #c4d8d6; border-radius: 12px; }
.daily-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.daily-result h3 { margin: 0; font-size: 0.9rem; }
#daily-result-text { display: block; width: 100%; min-height: 176px; padding: 10px; resize: vertical; color: var(--ink); background: white; border-color: #c4d8d6; border-radius: 8px; font-size: 0.8rem; line-height: 1.65; }

.people-list, .history-list { display: grid; gap: 12px; }
.person-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 18px rgb(18 57 58 / 0.04); }
.person-overview { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 17px 15px; }
.person-name { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.person-score { display: flex; align-items: baseline; gap: 6px; text-align: right; white-space: nowrap; }
.person-score strong { font-size: 1.6rem; letter-spacing: -0.05em; }
.person-score span { color: var(--muted); font-size: 0.78rem; }

.action-form { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto auto; gap: 8px; padding: 12px 17px; background: var(--soft); border-top: 1px solid var(--line); }
.action-form input { min-height: 38px; padding: 0 10px; }
.action-form button { min-height: 38px; padding: 0 13px; }
.add-score { color: white; background: var(--positive); }
.deduct-score { color: white; background: var(--negative); }
.quick-actions { display: flex; gap: 7px; flex-wrap: wrap; padding: 11px 17px 14px; border-top: 1px solid var(--line); }
.quick-actions button { min-height: 36px; padding: 0 9px; color: var(--teal); background: white; border-color: var(--line); font-size: 0.78rem; }
.quick-actions button:hover { border-color: var(--teal-bright); }
.person-footer { display: flex; justify-content: space-between; gap: 14px; padding: 0 17px 14px; color: var(--muted); font-size: 0.78rem; }
.person-footer > span { min-width: 0; overflow-wrap: anywhere; }
.delete-person { flex: 0 0 auto; margin-left: auto; min-height: 36px; padding: 4px 0; color: #8a5550; background: transparent; font-size: 0.78rem; text-decoration: underline; text-underline-offset: 2px; }

.history-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.history-marker { width: 9px; height: 9px; border-radius: 50%; background: var(--positive); }
.history-marker.deduct { background: var(--negative); }
.history-main { min-width: 0; }
.history-title { margin: 0 0 2px; font-weight: 800; overflow-wrap: anywhere; }
.history-note { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; overflow-wrap: anywhere; }
.history-value { text-align: right; white-space: nowrap; }
.history-value strong { display: block; font-size: 1.03rem; }
.history-value small { color: var(--muted); font-size: 0.7rem; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }

.empty-state { padding: 30px 18px; color: var(--muted); text-align: center; background: rgb(238 245 244 / 0.6); border: 1px dashed #b6c9c8; border-radius: 14px; }
.empty-state strong { display: block; color: var(--ink); }
.empty-state p { margin: 7px 0 0; font-size: 0.88rem; line-height: 1.6; }
.compact-empty { padding: 24px 14px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.match-closing { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 24px; background: rgb(8 38 40 / 0.58); }
.match-closing-card { width: min(100%, 330px); padding: 30px 24px; text-align: center; background: var(--surface); border-radius: 18px; box-shadow: 0 18px 52px rgb(0 0 0 / 0.24); }
.match-closing-card h2 { margin: 12px 0 6px; font-size: 1.25rem; }
.match-closing-card p { margin: 0; color: var(--muted); }
.closing-mark { display: grid; width: 50px; height: 50px; margin: 0 auto; place-items: center; color: white; background: var(--positive); border-radius: 50%; font-size: 1.7rem; font-weight: 900; }
.match-closing[hidden] { display: none !important; }
[data-home-panel][hidden] { display: none !important; }
.lobby-shell .action-form, .lobby-shell .quick-actions, .lobby-shell .delete-person { display: none; }
.lobby-shell .person-footer { justify-content: flex-start; }
.lobby-shell, .match-shell, .records-shell { padding-bottom: calc(98px + env(safe-area-inset-bottom)); }
.bottom-nav { position: fixed; z-index: 15; bottom: max(10px, env(safe-area-inset-bottom)); left: 50%; display: grid; grid-template-columns: repeat(3, 1fr); width: min(calc(100% - 24px), 500px); padding: 6px; gap: 4px; background: rgb(255 255 255 / 0.96); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px rgb(18 57 58 / 0.16); transform: translateX(-50%); }
.bottom-nav-item { display: grid; min-height: 52px; place-items: center; gap: 2px; padding: 4px 8px; color: var(--muted); background: transparent; border: 0; border-radius: 11px; font-size: 0.74rem; font-weight: 800; line-height: 1.1; text-decoration: none; }
.bottom-nav-item span { font-size: 1.15rem; line-height: 1; }
.bottom-nav-item.is-active { color: white; background: var(--teal); }
.bottom-nav-item:not(.is-active):hover { color: var(--teal); background: var(--soft); }
.match-shell { width: min(100% - 48px, 920px); }
.records-shell { width: min(100% - 48px, 760px); }
.records-header { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.records-header h1 { margin: 0; }
.records-header .subtitle { margin-bottom: 0; }
.match-page-header { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 17px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.match-page-header h1 { margin: 0; }
.match-page-header .subtitle { margin-bottom: 0; }
.back-button { min-height: 42px; padding: 0 11px; color: var(--teal); background: white; border-color: #b6c9c8; white-space: nowrap; }
.match-setup-card { display: grid; gap: 10px; max-width: 610px; margin: 34px auto; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.match-setup-card h2, .match-add-person h2 { margin: 0; }
.match-setup-card > p:not(.section-kicker), .match-add-person p:not(.section-kicker) { margin: 0; color: var(--muted); line-height: 1.6; }
.match-start-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-top: 8px; }
.match-start-form label { grid-column: 1 / -1; font-weight: 800; }
.match-start-form button, .match-add-person button { min-height: 46px; padding: 0 17px; color: white; background: var(--teal); }
.match-add-person { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr); gap: 24px; align-items: end; padding: 23px 0; border-bottom: 1px solid var(--line); }
.match-add-person .add-person-form { width: 100%; align-self: end; }
#match-person-name { flex: 1 1 150px; min-width: 0; }
.close-match-button { display: block; width: min(100%, 360px); min-height: 48px; margin: 28px auto 0; color: white; background: #8a5550; }
#match-report { margin-top: 22px; }
.session-view { padding-top: 14px; }
.session-records { padding-top: 5px; }
.session-records h2 { margin: 0 0 10px; font-size: 1.1rem; }

@media (max-width: 1023px) {
  .workspace { grid-template-columns: 1fr; gap: 8px; }
  .history-section { padding-left: 0; border-left: 0; }
  .import-section { grid-template-columns: 1fr; }
  .import-score-form, .form-hint { grid-column: 1; }
}

@media (max-width: 599px) {
  .app-shell {
    width: 100%;
    padding:
      24px max(16px, env(safe-area-inset-right))
      calc(28px + env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }
  .app-header { grid-template-columns: 1fr; align-items: start; }
  .total-panel { width: 100%; min-width: 0; grid-template-columns: 1fr auto; align-items: center; }
  .total-panel strong { grid-row: span 2; grid-column: 2; }
  .total-panel small { grid-column: 1; }
  .add-person-section { display: grid; gap: 15px; padding: 21px 0; }
  .match-section { display: grid; gap: 15px; padding: 21px 0; }
  .match-actions { width: 100%; }
  .match-actions button { flex: 1 1 0; min-height: 46px; }
  .match-history-item { align-items: flex-start; }
  .match-history-item button { min-height: 44px; }
  .match-shell { width: 100%; }
  .bottom-nav { bottom: max(8px, env(safe-area-inset-bottom)); width: calc(100% - 20px); }
  .bottom-nav-item { min-height: 52px; }
  .match-page-header { grid-template-columns: 1fr; gap: 13px; }
  .back-button { justify-self: start; min-height: 44px; }
  .match-setup-card { margin: 24px 0; padding: 21px 17px; }
  .match-start-form { grid-template-columns: 1fr; }
  .match-start-form button { width: 100%; min-height: 46px; }
  .match-add-person { grid-template-columns: 1fr; gap: 14px; padding: 21px 0; }
  .add-person-form { display: grid; grid-template-columns: 1fr; }
  .add-person-form button { width: 100%; }
  .import-section { gap: 13px; padding: 21px 0; }
  .import-score-form { grid-template-columns: minmax(0, 1fr) 116px; gap: 8px; }
  .import-score-form button { grid-column: 1 / -1; width: 100%; }
  .form-hint { margin: 0; }
  .section-heading { align-items: center; }
  .people-toolbar { justify-content: flex-start; }
  .filter-button { min-height: 44px; padding: 0 12px; }
  .result-button, .copy-button { min-height: 44px; }
  .person-overview { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .person-score { display: grid; gap: 2px; justify-items: end; }
  .person-score span { font-size: 0.72rem; }
  .action-form { grid-template-columns: 78px 1fr; }
  .action-form input, .action-form button { min-height: 44px; }
  .action-form button { width: 100%; }
  .quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .quick-actions button { width: 100%; min-height: 44px; }
  .person-footer { align-items: center; }
  .history-item { grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; }
  .history-value strong { font-size: 0.95rem; }
  input, textarea { font-size: 16px; }
  #daily-result-text { min-height: 156px; }
  .person-score strong { font-size: 1.4rem; }
}

@media (max-width: 899px) and (orientation: landscape) {
  .app-shell { padding-top: 16px; }
  .app-header { padding-bottom: 18px; }
  .add-person-section { padding: 17px 0; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; } }

.auth-shell {
  display: grid;
  width: min(100% - 32px, 460px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 0 max(28px, env(safe-area-inset-bottom));
  place-items: center;
}
.auth-shell[hidden], .app-shell[hidden] { display: none !important; }
.auth-card {
  display: grid;
  width: 100%;
  gap: 9px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0; font-size: 2rem; }
.auth-card .subtitle { margin-bottom: 12px; font-size: 0.9rem; }
.auth-card label { font-size: 0.85rem; font-weight: 800; }
.auth-card input { width: 100%; padding: 0 13px; }
.auth-card > button[type="submit"] { margin-top: 8px; color: white; background: var(--teal); }
.auth-card > button[type="submit"]:hover { background: var(--teal-bright); }
.auth-card > button:disabled { cursor: wait; opacity: 0.65; }
.auth-status { min-height: 20px; margin: 3px 0 0; color: var(--negative); font-size: 0.82rem; font-weight: 700; }
.text-button { min-height: 34px; padding: 0; color: var(--teal); background: transparent; font-size: 0.82rem; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
.account-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 15px; color: var(--muted); font-size: 0.8rem; }
.account-bar strong { color: var(--ink); }
.logout-button { min-height: 32px; padding: 0; color: var(--teal); background: transparent; font-size: 0.8rem; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 599px) {
  .auth-shell {
    width: 100%;
    padding:
      max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .auth-card { padding: 22px; }
  .auth-card input { font-size: 16px; }
  .lobby-shell, .match-shell, .records-shell { padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
}

/* Editorial data interface refresh */
:root {
  --ink: #131617;
  --muted: #687174;
  --line: #dfe2e1;
  --soft: #f0f2f1;
  --paper: #f7f7f5;
  --surface: #ffffff;
  --teal: #0d5960;
  --teal-bright: #0a7077;
  --positive: #0e705f;
  --negative: #b3403f;
  --shadow: 0 18px 42px rgb(20 29 30 / 0.08);
}

html { background: var(--paper); }
body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 94% 4%, rgb(38 198 215 / 0.08), transparent 28rem),
    radial-gradient(circle at 5% 42%, rgb(255 102 61 / 0.045), transparent 27rem),
    var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.005em;
}

.app-shell { width: min(100% - 48px, 1320px); padding-top: 42px; }
.app-header, .match-page-header, .records-header {
  position: relative;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.app-header::before, .match-page-header::before, .records-header::before {
  position: absolute;
  top: -2px;
  left: 0;
  width: 96px;
  height: 3px;
  content: "";
  background: linear-gradient(90deg, #ff713d, #f74395 42%, #7757fa 70%, #21c9d5);
  border-radius: 999px;
}
.app-header { padding-bottom: 34px; }
.eyebrow, .section-kicker {
  margin-bottom: 10px;
  color: #313839;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}
h1 { margin-bottom: 10px; font-size: clamp(2.25rem, 5vw, 4rem); font-weight: 850; letter-spacing: -0.075em; line-height: 0.95; }
h2 { font-size: 1.25rem; font-weight: 850; letter-spacing: -0.045em; }
.subtitle { max-width: 38rem; color: var(--muted); font-size: 0.98rem; line-height: 1.7; }
.account-bar { margin-top: 18px; color: #4d5759; }
.account-bar strong { color: var(--ink); }
.logout-button { color: var(--teal); font-weight: 800; }

.total-panel {
  min-width: 222px;
  padding: 21px 22px 19px;
  color: var(--ink);
  background: linear-gradient(145deg, #ffffff, #f4f5f4);
  border: 1px solid #e4e6e5;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.total-panel span { color: var(--muted); font-weight: 800; opacity: 1; }
.total-panel strong { margin: 5px 0; font-size: 3rem; font-weight: 850; letter-spacing: -0.08em; }
.total-panel small { color: var(--muted); opacity: 1; }

input {
  min-height: 48px;
  padding: 0 14px;
  border-color: #d3d8d7;
  border-radius: 11px;
  background: rgb(255 255 255 / 0.9);
}
input::placeholder { color: #9aa2a3; }
input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgb(13 89 96 / 0.11); }
button { min-height: 44px; border-radius: 11px; font-weight: 850; transition: transform 150ms ease, box-shadow 150ms ease, color 150ms ease, background 150ms ease, border-color 150ms ease; }
button:active { transform: translateY(1px); }

.match-section {
  position: relative;
  margin-top: 24px;
  padding: 24px 26px;
  background: linear-gradient(110deg, rgb(255 255 255 / 0.95), rgb(245 249 248 / 0.9));
  border: 1px solid #e0e5e4;
  border-radius: 18px;
}
.match-section::before {
  position: absolute;
  top: 0;
  left: 26px;
  width: 82px;
  height: 3px;
  content: "";
  background: linear-gradient(90deg, #ff713d, #f74395 43%, #7757fa 72%, #21c9d5);
  border-radius: 999px;
}
.match-section h2 { font-size: 1.4rem; }
.match-status { color: var(--muted); }
.match-actions button { min-height: 46px; padding: 0 17px; background: var(--ink); box-shadow: 0 9px 18px rgb(19 22 23 / 0.16); }
.match-actions button:hover { background: #293031; }
.match-actions .end-match { color: var(--ink); background: white; border-color: #d4d9d8; box-shadow: none; }
.match-actions .end-match:hover { background: var(--soft); }

.workspace { padding-top: 26px; }
.section-heading { align-items: center; padding: 16px 0 14px; border-top: 1px solid var(--line); }
.people-toolbar { gap: 10px; }
.people-filter { border-color: #d5dad9; border-radius: 10px; box-shadow: 0 3px 10px rgb(20 29 30 / 0.03); }
.filter-button { min-height: 40px; color: #4d5758; font-weight: 800; }
.filter-button.is-active { background: var(--ink); }
.people-sort {
  min-height: 40px;
  padding: 0 34px 0 12px;
  color: #3e4849;
  background-color: rgb(255 255 255 / 0.78);
  border: 1px solid #d5dad9;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgb(20 29 30 / 0.03);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}
.people-sort:focus-visible { outline: 3px solid rgb(70 105 107 / 0.18); outline-offset: 2px; }
.summary-chip { padding: 6px 10px; color: #3b4647; background: #e9edec; border-radius: 999px; }
.people-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.history-list { grid-template-columns: 1fr; }
.person-card {
  border-color: #e1e5e4;
  border-radius: 16px;
  box-shadow: 0 11px 26px rgb(20 29 30 / 0.055);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.person-card:hover { border-color: #ccd6d5; box-shadow: 0 15px 30px rgb(20 29 30 / 0.09); transform: translateY(-2px); }
.person-overview { padding: 19px 19px 17px; }
.person-name { font-size: 1.14rem; font-weight: 850; }
.person-score strong { font-size: 2rem; font-weight: 850; }
.person-score span { color: var(--muted); }
.action-form { padding: 13px 19px; background: #f3f5f4; border-top-color: #e2e6e5; }
.action-form button { min-height: 40px; }
.add-score { background: var(--ink); }
.deduct-score { background: var(--negative); }
.quick-actions { padding: 12px 19px 15px; border-top-color: #e2e6e5; }
.quick-actions button { color: #3e4849; border-color: #d8dedd; background: white; }
.quick-actions button:hover { color: var(--teal); border-color: var(--teal); background: #f5fbfa; }
.person-footer { padding: 0 19px 15px; }

.match-add-person {
  margin-top: 22px;
  padding: 24px;
  background: linear-gradient(125deg, #ffffff, #f3f7f6);
  border: 1px solid #e0e6e5;
  border-radius: 18px;
}
.match-add-person .add-person-form { gap: 9px; }
.match-start-form button, .match-add-person button { background: var(--ink); box-shadow: 0 9px 18px rgb(19 22 23 / 0.14); }
.match-setup-card { border-color: #e0e5e4; border-radius: 18px; box-shadow: var(--shadow); }
.match-setup-card::before { display: block; width: 88px; height: 3px; margin-bottom: 12px; content: ""; background: linear-gradient(90deg, #ff713d, #f74395 43%, #7757fa 72%, #21c9d5); border-radius: 999px; }
.close-match-button { background: var(--ink); border-radius: 12px; box-shadow: 0 11px 22px rgb(19 22 23 / 0.17); }
.back-button { color: var(--ink); border-color: #d7dcdb; border-radius: 10px; }
.back-button:hover { background: var(--soft); }

.match-history-section { padding: 18px 0 24px; border-bottom: 0; }
.match-history-list { gap: 11px; }
.match-history-item { padding: 16px 17px; background: rgb(255 255 255 / 0.72); border-color: #e0e4e3; border-radius: 14px; }
.match-history-item:hover { border-color: #cbd6d5; box-shadow: 0 9px 19px rgb(20 29 30 / 0.055); }
.match-history-item strong { font-size: 1rem; }
.match-history-item button, .copy-button { color: var(--ink); border-color: #d6dcdb; border-radius: 10px; }
.match-history-item button:hover, .copy-button:hover { color: var(--teal); border-color: var(--teal); background: #f5fbfa; }
.daily-result { border-color: #dfe5e3; border-radius: 16px; background: #f1f4f3; }
.empty-state { background: rgb(255 255 255 / 0.52); border-color: #ccd7d5; border-radius: 16px; }

.bottom-nav {
  width: min(calc(100% - 28px), 480px);
  padding: 6px;
  background: rgb(255 255 255 / 0.94);
  border-color: #d9dedc;
  border-radius: 17px;
  box-shadow: 0 16px 34px rgb(20 29 30 / 0.16);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.bottom-nav-item { color: #657071; border-radius: 12px; }
.bottom-nav-item.is-active { background: var(--ink); }
.bottom-nav-item:not(.is-active):hover { color: var(--teal); background: #edf2f1; }

.auth-card { border-color: #e0e5e3; border-radius: 18px; box-shadow: var(--shadow); }
.auth-card > button[type="submit"] { background: var(--ink); }
.auth-card > button[type="submit"]:hover { background: #293031; }
.auth-status { color: var(--negative); }

@media (max-width: 1023px) {
  .people-list { grid-template-columns: 1fr; }
}

@media (max-width: 599px) {
  .app-shell, .match-shell, .records-shell { width: 100%; padding-top: 28px; }
  .app-header, .match-page-header, .records-header { padding-top: 16px; }
  h1 { font-size: clamp(2.15rem, 11vw, 3.2rem); }
  .total-panel { min-width: 0; padding: 18px; border-radius: 16px; }
  .total-panel strong { font-size: 2.55rem; }
  .match-section { margin-top: 18px; padding: 21px 18px; border-radius: 16px; }
  .match-section::before { left: 18px; }
  .match-add-person { margin-top: 16px; padding: 20px 17px; border-radius: 16px; }
  .person-card { border-radius: 15px; }
  .person-card:hover { transform: none; }
  .people-sort { min-height: 44px; }
  .person-overview, .action-form, .quick-actions, .person-footer { padding-left: 16px; padding-right: 16px; }
  .bottom-nav { width: calc(100% - 20px); }
}

/* Frosted glass interface refresh: visual treatment only. */
:root {
  --glass-surface: rgb(255 255 255 / 0.64);
  --glass-surface-strong: rgb(255 255 255 / 0.78);
  --glass-border: rgb(255 255 255 / 0.78);
  --glass-border-muted: rgb(162 174 178 / 0.38);
  --glass-shadow: 0 18px 46px rgb(68 78 82 / 0.13), 0 3px 10px rgb(68 78 82 / 0.05);
}

html { background: #e8eeef; }
body {
  background:
    radial-gradient(circle at 8% 8%, rgb(255 255 255 / 0.92), transparent 27rem),
    radial-gradient(circle at 92% 12%, rgb(119 211 216 / 0.26), transparent 26rem),
    radial-gradient(circle at 44% 97%, rgb(193 204 209 / 0.5), transparent 31rem),
    linear-gradient(145deg, #eef3f4, #dce5e7 52%, #e8eeef);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(120deg, rgb(255 255 255 / 0.24), transparent 38%, rgb(255 255 255 / 0.18));
}

.app-header, .match-page-header, .records-header { border-top-color: rgb(255 255 255 / 0.7); }

.auth-card,
.total-panel,
.match-section,
.person-card,
.match-add-person,
.match-setup-card,
.match-history-item,
.daily-result,
.empty-state,
.session-records,
.match-closing-card {
  background: linear-gradient(135deg, rgb(255 255 255 / 0.78), rgb(255 255 255 / 0.48));
  border-color: var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.auth-card,
.match-setup-card { position: relative; overflow: hidden; }

.auth-card::before,
.match-setup-card::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(135deg, rgb(255 255 255 / 0.42), transparent 42%);
}

.auth-card > *,
.match-setup-card > * { position: relative; z-index: 1; }

.auth-card { gap: 10px; padding: 32px; border-radius: 24px; }
.auth-card h1 { font-size: clamp(2.05rem, 8vw, 2.7rem); }
.auth-card .subtitle { margin-bottom: 14px; }
.auth-card label { color: #334042; }

input,
textarea,
#daily-result-text {
  background: rgb(255 255 255 / 0.74);
  border-color: var(--glass-border-muted);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.65);
}

input:focus,
textarea:focus {
  background: rgb(255 255 255 / 0.93);
  border-color: rgb(13 89 96 / 0.8);
  box-shadow: 0 0 0 4px rgb(13 89 96 / 0.13), inset 0 1px 0 rgb(255 255 255 / 0.85);
}

.auth-card > button[type="submit"],
.match-actions button,
.match-start-form button,
.match-add-person button,
.close-match-button,
.add-score {
  background: linear-gradient(135deg, #115d64, #0b4b51);
  box-shadow: 0 9px 18px rgb(35 65 69 / 0.2), inset 0 1px 0 rgb(255 255 255 / 0.16);
}

.auth-card > button[type="submit"]:hover,
.match-actions button:hover,
.match-start-form button:hover,
.match-add-person button:hover,
.close-match-button:hover,
.add-score:hover { background: linear-gradient(135deg, #14747b, #0d5960); }

.total-panel {
  background: linear-gradient(135deg, rgb(255 255 255 / 0.82), rgb(244 250 250 / 0.54));
  border-radius: 22px;
}

.match-section,
.match-add-person { border-color: var(--glass-border); }
.action-form,
.quick-actions { background: rgb(241 246 246 / 0.48); border-top-color: rgb(255 255 255 / 0.64); }
.quick-actions button,
.match-actions .end-match,
.back-button,
.match-history-item button,
.copy-button {
  background: rgb(255 255 255 / 0.56);
  border-color: var(--glass-border-muted);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.72);
}

.person-card:hover,
.match-history-item:hover {
  border-color: rgb(255 255 255 / 0.96);
  box-shadow: 0 22px 44px rgb(68 78 82 / 0.16), 0 4px 12px rgb(68 78 82 / 0.06);
}

.people-filter,
.summary-chip {
  background: rgb(255 255 255 / 0.52);
  border-color: var(--glass-border);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.72);
}

.bottom-nav {
  background: rgb(250 253 253 / 0.66);
  border-color: var(--glass-border);
  box-shadow: 0 18px 42px rgb(53 66 70 / 0.18), inset 0 1px 0 rgb(255 255 255 / 0.76);
}

.bottom-nav-item.is-active {
  background: linear-gradient(135deg, #145f66, #0b4c52);
  box-shadow: 0 6px 14px rgb(22 74 80 / 0.2), inset 0 1px 0 rgb(255 255 255 / 0.16);
}

.match-closing { background: rgb(33 47 50 / 0.28); }

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .auth-card,
  .total-panel,
  .match-section,
  .person-card,
  .match-add-person,
  .match-setup-card,
  .match-history-item,
  .daily-result,
  .empty-state,
  .session-records,
  .match-closing-card,
  .bottom-nav,
  .people-filter,
  .summary-chip {
    -webkit-backdrop-filter: blur(20px) saturate(135%);
    backdrop-filter: blur(20px) saturate(135%);
  }
}

/* Keep read-only match records inside the glass card on narrow screens. */
.session-records {
  min-width: 0;
  padding: 20px clamp(16px, 4vw, 24px) 12px;
  overflow: hidden;
}

.session-records .history-list,
.session-records .history-item { min-width: 0; }

.session-records .history-value {
  min-width: 70px;
  text-align: right;
}

.session-records .history-value small {
  font-size: 0.7rem;
  white-space: nowrap;
}

@media (max-width: 599px) {
  .session-records { padding: 18px 16px 10px; }
  .session-records .history-item { gap: 8px; }
}

@media (prefers-reduced-transparency: reduce) {
  .auth-card,
  .total-panel,
  .match-section,
  .person-card,
  .match-add-person,
  .match-setup-card,
  .match-history-item,
  .daily-result,
  .empty-state,
  .session-records,
  .match-closing-card,
  .bottom-nav { background: #f8fbfb; }
}

@media (max-width: 599px) {
  .auth-card { padding: 26px 22px; border-radius: 21px; }
  .auth-shell { width: min(100% - 24px, 460px); }
  .match-section, .match-add-person, .match-setup-card { border-radius: 18px; }
}

/* Silver frosted login composition, based on the supplied reference. */
:root {
  --ink: #2e343b;
  --muted: #68707a;
  --teal: #373d45;
  --teal-bright: #252a31;
  --positive: #28685f;
  --negative: #a4444d;
  --glass-border: rgb(255 255 255 / 0.8);
  --glass-border-muted: rgb(122 131 141 / 0.28);
  --glass-shadow: 0 28px 60px rgb(66 75 84 / 0.15), 0 5px 14px rgb(66 75 84 / 0.06);
}

body {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(ellipse 55% 72% at 15% 34%, rgb(255 255 255 / 0.97) 0 19%, transparent 62%),
    radial-gradient(ellipse 64% 56% at 100% 97%, rgb(255 255 255 / 0.94) 0 22%, transparent 68%),
    linear-gradient(135deg, #d7d8da 0%, #f5f5f4 35%, #dedfe1 68%, #f2f2f2 100%);
}

body::before {
  z-index: 0;
  inset: -18% auto auto -16%;
  width: 82vmax;
  height: 56vmax;
  border-radius: 48% 52% 56% 44%;
  background:
    radial-gradient(ellipse at 18% 52%, rgb(255 255 255 / 0.9), transparent 48%),
    linear-gradient(147deg, rgb(255 255 255 / 0.66), rgb(195 198 202 / 0.24) 53%, transparent 73%);
  filter: blur(10px);
  transform: rotate(-11deg);
}

body::after {
  position: fixed;
  z-index: 0;
  right: -24vmax;
  bottom: -21vmax;
  width: 72vmax;
  height: 52vmax;
  content: "";
  pointer-events: none;
  background: radial-gradient(ellipse at 35% 31%, rgb(255 255 255 / 0.96), rgb(255 255 255 / 0.48) 40%, transparent 68%);
  border-radius: 55% 45% 0 0;
  filter: blur(4px);
  transform: rotate(-13deg);
}

body > * { position: relative; z-index: 1; }

.auth-shell {
  width: 100%;
  min-height: 100dvh;
  padding: max(40px, env(safe-area-inset-top)) 24px max(40px, env(safe-area-inset-bottom));
}

.auth-card {
  width: min(100%, 666px);
  min-height: 710px;
  justify-content: center;
  gap: 12px;
  padding: 54px 68px 42px;
  color: #2e343b;
  text-align: center;
  background: linear-gradient(135deg, rgb(255 255 255 / 0.62), rgb(247 247 247 / 0.39));
  border: 1px solid rgb(255 255 255 / 0.82);
  border-radius: 34px;
  box-shadow: 0 30px 62px rgb(61 68 76 / 0.18), inset 0 1px 0 rgb(255 255 255 / 0.78);
}

.auth-card::before {
  background: linear-gradient(135deg, rgb(255 255 255 / 0.46), transparent 46%, rgb(255 255 255 / 0.12));
}

.auth-brand-mark {
  display: grid;
  width: 66px;
  height: 72px;
  margin: 0 auto 2px;
  place-items: center;
  clip-path: polygon(50% 0, 94% 24%, 94% 76%, 50% 100%, 6% 76%, 6% 24%);
  background: #343a42;
}

.auth-brand-mark::before {
  width: 60px;
  height: 65px;
  content: "";
  clip-path: inherit;
  background: linear-gradient(135deg, rgb(255 255 255 / 0.88), rgb(235 236 237 / 0.58));
}

.auth-brand-mark::after {
  position: absolute;
  width: 20px;
  height: 24px;
  content: "";
  border: solid #343a42;
  border-width: 0 3px 3px 0;
  transform: rotate(-135deg) skew(-10deg, -10deg);
}

.auth-card .eyebrow {
  margin: 6px 0 22px;
  color: #4e555e;
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  text-align: center;
}

.auth-card h1 {
  margin: 0;
  color: #2d333b;
  font-size: clamp(2.05rem, 4vw, 2.7rem);
  font-weight: 780;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.auth-card .subtitle {
  max-width: none;
  margin: 0 0 26px;
  color: #69717b;
  font-size: 1rem;
  line-height: 1.5;
  text-align: center;
}

.auth-card label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-card input {
  width: 100%;
  min-height: 68px;
  padding: 0 21px;
  color: #333943;
  background: rgb(255 255 255 / 0.64);
  border: 1px solid rgb(129 137 147 / 0.26);
  border-radius: 13px;
  box-shadow: inset 0 1px 1px rgb(255 255 255 / 0.9), 0 1px 2px rgb(54 61 70 / 0.035);
  font-size: 1rem;
}

.auth-card input::placeholder { color: #9299a2; }
.auth-card input:focus {
  background: rgb(255 255 255 / 0.84);
  border-color: #68717c;
  box-shadow: 0 0 0 3px rgb(81 90 101 / 0.12), inset 0 1px 1px rgb(255 255 255 / 0.9);
}

.auth-card > button[type="submit"] {
  min-height: 68px;
  margin-top: 18px;
  color: #fff;
  background: linear-gradient(135deg, #4a5059, #30353c 72%);
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 13px;
  box-shadow: 0 12px 21px rgb(38 43 50 / 0.2), inset 0 1px 0 rgb(255 255 255 / 0.16);
  font-size: 1rem;
}

.auth-card > button[type="submit"]:hover { background: linear-gradient(135deg, #5a6069, #363b43 72%); }
.auth-status { width: 100%; min-height: 18px; margin: 2px 0 0; text-align: left; }
.text-button {
  justify-self: center;
  min-height: 34px;
  margin-top: 12px;
  color: #414952;
  font-weight: 700;
  text-decoration-color: rgb(65 73 82 / 0.42);
}

.total-panel,
.match-section,
.person-card,
.match-add-person,
.match-setup-card,
.match-history-item,
.daily-result,
.empty-state,
.session-records,
.match-closing-card {
  background: linear-gradient(135deg, rgb(255 255 255 / 0.7), rgb(244 245 246 / 0.44));
  border-color: rgb(255 255 255 / 0.78);
  box-shadow: var(--glass-shadow);
}

.bottom-nav { background: rgb(250 251 252 / 0.69); }
.bottom-nav-item.is-active,
.match-actions button,
.match-start-form button,
.match-add-person button,
.close-match-button,
.add-score { background: linear-gradient(135deg, #4a5059, #30353c 72%); }

@media (max-width: 599px) {
  .auth-shell { padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom)); }
  .auth-card {
    min-height: 0;
    padding: 38px 24px 30px;
    border-radius: 25px;
  }
  .auth-brand-mark { width: 54px; height: 59px; }
  .auth-brand-mark::before { width: 49px; height: 53px; }
  .auth-brand-mark::after { width: 16px; height: 19px; border-width: 0 2px 2px 0; }
  .auth-card .eyebrow { margin-bottom: 18px; font-size: 0.63rem; }
  .auth-card h1 { font-size: clamp(1.9rem, 9vw, 2.35rem); }
  .auth-card .subtitle { margin-bottom: 20px; font-size: 0.9rem; }
  .auth-card input, .auth-card > button[type="submit"] { min-height: 56px; }
  .auth-card > button[type="submit"] { margin-top: 10px; }
}

/* More breathing room in match and archive page headers. */
.match-page-header { column-gap: 28px; padding-bottom: 31px; }
.match-page-header .eyebrow,
.records-header .eyebrow { margin: 2px 0 12px; }
.match-page-header h1,
.records-header h1 { margin: 0 0 10px; line-height: 1.12; }
.match-page-header .subtitle,
.records-header .subtitle { line-height: 1.65; }
.records-header { padding-bottom: 27px; }

@media (max-width: 599px) {
  .match-page-header { row-gap: 18px; padding-bottom: 26px; }
  .match-page-header .eyebrow,
  .records-header .eyebrow { margin-bottom: 10px; }
  .match-page-header h1,
  .records-header h1 { margin-bottom: 8px; }
  .records-header { padding-bottom: 23px; }
}

/* Required visual attribution. See LICENSE for redistribution conditions. */
.design-credit {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin: 42px 0 18px;
  padding: 15px 0 0;
  border-top: 1px solid rgb(255 255 255 / 0.7);
  font-size: 0.76rem;
  letter-spacing: 0.035em;
  text-align: center;
}

.design-credit a {
  color: #454d57;
  font-weight: 760;
  text-decoration: none;
  text-underline-offset: 4px;
}

.design-credit a:hover,
.design-credit a:focus-visible {
  color: #161b20;
  text-decoration: underline;
}

.design-credit-home {
  justify-content: flex-start;
  min-height: 0;
  margin: 15px 0 0;
  padding: 0;
  border-top: 0;
}

.auth-shell { position: relative; }
.login-design-credit {
  position: absolute;
  top: max(26px, env(safe-area-inset-top));
  left: max(28px, env(safe-area-inset-left));
  z-index: 2;
  color: #454d57;
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.035em;
  text-decoration: none;
  text-underline-offset: 4px;
}

.login-design-credit:hover,
.login-design-credit:focus-visible {
  color: #161b20;
  text-decoration: underline;
}

@media (max-width: 599px) {
  .design-credit {
    min-height: 42px;
    margin: 30px 0 12px;
    padding-top: 13px;
    font-size: 0.7rem;
  }
  .design-credit-home { margin-top: 12px; }
  .login-design-credit {
    top: max(18px, env(safe-area-inset-top));
    left: max(20px, env(safe-area-inset-left));
    font-size: 0.7rem;
  }
}
