
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #101411;
  --panel: #191f1b;
  --panel-hover: #1e2620;
  --border: #2b352d;
  --text: #f0f4ef;
  --muted: #8e9c90;
  --green: #a3e66b;
  --green-dark: #263c25;
  --red: #ff817c;
  --red-dark: #402725;
  --gold: #f0c46d;
  --gold-dark: #3b3220;
  --blue: #88baff;
  --blue-dark: #233449;
  --purple: #c1a6ff;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px;
  background:
    radial-gradient(ellipse at 15% 0%, #1c2a1d 0, transparent 38%),
    var(--bg);
  color: var(--text);
  font-family: 'DM Sans', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.app-shell {
  max-width: 1120px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  background: var(--green);
  color: #14200f;
  border-radius: 10px;
  font-size: 25px;
}

.brand-light {
  color: var(--green);
  margin-left: 5px;
}

.saved-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
}

.welcome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 28px 0 22px;
}

.eyebrow {
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  margin: 0 0 7px;
}

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

h1, h2 {
  font-family: 'Space Grotesk', sans-serif;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(25px, 3vw, 32px);
  letter-spacing: -1px;
}

h2 {
  font-size: 17px;
  margin-bottom: 0;
}

h3 {
  font-size: 13px;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 0;
  font-size: 13px;
}

.session-badge,
.small-pill {
  color: var(--green);
  background: #202e20;
  border: 1px solid #344b31;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 11px;
  white-space: nowrap;
}

.session-badge span {
  margin-right: 5px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.panel {
  background: linear-gradient(145deg, #1b211d, #171c19);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
  box-shadow: 0 5px 18px #0000000a;
}

.card-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}

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

.card-heading .muted {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .7px;
}

.icon-box {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: 17px;
  flex-shrink: 0;
}

.green-icon { background: var(--green-dark); color: var(--green); }
.red-icon { background: var(--red-dark); color: var(--red); }
.gold-icon { background: var(--gold-dark); color: var(--gold); }
.blue-icon { background: var(--blue-dark); color: var(--blue); }
.purple-icon { background: #302747; color: var(--purple); }

.big-number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.25;
  margin: 17px 0 7px;
  font-variant-numeric: tabular-nums;
}

.green-text { color: var(--green); }
.red-text { color: var(--red); }
.gold-text { color: var(--gold); }
.blue-text { color: var(--blue); }

.card-foot {
  color: var(--muted);
  font-size: 11px;
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.section-heading .eyebrow {
  margin-bottom: 4px;
}

.small-pill {
  padding: 5px 8px;
  font-size: 9px;
}

.win-rate {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.rate-number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 30px;
  font-weight: 700;
  margin-top: 3px;
}

.rate-circle {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0deg, #303b32 0deg);
  position: relative;
  font-weight: 700;
  font-size: 12px;
}

.rate-circle::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--panel);
}

.rate-circle span {
  position: relative;
}

.progress-track {
  display: flex;
  height: 7px;
  overflow: hidden;
  background: #303b32;
  border-radius: 10px;
  gap: 3px;
}

.progress-track span {
  display: block;
  width: 0;
  transition: width .25s ease;
}

.progress-wins { background: var(--green); }
.progress-draws { background: var(--gold); }
.progress-losses { background: var(--red); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 13px;
  font-size: 11px;
  color: var(--muted);
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.win-dot { background: var(--green); }
.draw-dot { background: var(--gold); }
.loss-dot { background: var(--red); }

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.subheading {
  margin-bottom: 5px;
}

.small-text {
  font-size: 11px;
  margin-bottom: 0;
}

.result-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 15px;
}

.action-button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 5px;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  transition: background .15s, transform .15s;
}

.action-button:active,
.primary-button:active {
  transform: scale(.98);
}

.win-button { border-color: #52794a; }
.win-button:hover { background: var(--green-dark); }
.loss-button { border-color: #78413e; }
.loss-button:hover { background: var(--red-dark); }
.draw-button { border-color: #786337; }
.draw-button:hover { background: var(--gold-dark); }

.chess-symbol {
  color: #7b8b7b;
  font-size: 23px;
}

.color-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-column {
  background: #131815;
  border: 1px solid #283129;
  border-radius: 10px;
  padding: 13px;
}

.color-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--border);
}

.piece {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 7px;
  font-size: 21px;
}

.white-piece {
  background: #e5e9df;
  color: #202820;
}

.black-piece {
  background: #303a32;
  color: #f0f4ef;
}

.color-total {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 25px;
  font-weight: 700;
  padding: 12px 0 7px;
  font-variant-numeric: tabular-nums;
}

.color-total small {
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 400;
}

.color-stat {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  padding: 7px 0;
  border-bottom: 1px solid #252e27;
  color: var(--muted);
  font-size: 11px;
}

.color-stat:last-child {
  border-bottom: 0;
}

.color-stat b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.color-stat .green-text { color: var(--green); }
.color-stat .red-text { color: var(--red); }
.color-stat .gold-text { color: var(--gold); }

.bottom-grid {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: 12px;
}

.timer-display {
  font-family: 'Space Grotesk', monospace;
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 700;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  margin: 21px 0;
  white-space: nowrap;
}

.timer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 42px;
  gap: 8px;
}

.primary-button,
.secondary-button,
.icon-button,
.text-button {
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.primary-button {
  background: var(--green);
  border: 1px solid var(--green);
  color: #13200f;
}

.secondary-button {
  background: #242c26;
  border: 1px solid #39453b;
  color: var(--text);
}

.secondary-button:hover { background: #303c32; }

.icon-button {
  background: #222a24;
  border: 1px solid var(--border);
  font-size: 19px;
}

button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.quality-panel .section-heading {
  margin-bottom: 15px;
}

.quality-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.quality-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.quality-info strong {
  font-size: 13px;
}

.quality-symbol {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--red-dark);
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
}

.quality-row:has(.blue-text) .quality-symbol {
  background: var(--blue-dark);
}

.quality-number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}

.quality-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.quality-actions .secondary-button {
  flex: 1;
}

.text-button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
}

.text-button:hover {
  color: var(--text);
  background: #262e28;
}

.quality-color-stats {
  display: grid;
  gap: 7px;
  font-size: 10px;
  color: var(--muted);
}

.quality-color-stats b {
  color: var(--text);
}

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .3px;
}

.footer-dot {
  color: var(--green);
  margin: 0 4px;
}

.reset-all {
  background: transparent;
  border: 1px solid #5b3835;
  color: var(--red);
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 11px;
  cursor: pointer;
}

.reset-all:hover {
  background: var(--red-dark);
}

.color-dialog {
  width: min(360px, calc(100% - 30px));
  border: 1px solid #3a493b;
  border-radius: 16px;
  padding: 25px;
  background: #1a211c;
  color: var(--text);
  box-shadow: 0 20px 100px #0009;
}

.color-dialog::backdrop {
  background: #050906bb;
  backdrop-filter: blur(4px);
}

.color-dialog form {
  text-align: center;
}

.dialog-symbol {
  display: grid;
  place-items: center;
  margin: 0 auto 15px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--green-dark);
  color: var(--green);
  font-size: 27px;
}

.color-dialog h2 {
  margin-bottom: 8px;
}

.color-dialog p {
  font-size: 12px;
  margin-bottom: 20px;
}

.dialog-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.color-choice {
  padding: 13px 5px;
  border-radius: 9px;
  background: #252f27;
  color: var(--text);
  border: 1px solid #435344;
  cursor: pointer;
  font-weight: 700;
}

.color-choice:hover {
  background: #344535;
}

.cancel-button {
  margin-top: 12px;
  width: 100%;
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 9px;
  cursor: pointer;
}

@media (min-width: 900px) {
  .panel {
    padding: 20px;
  }
}

@media (max-width: 800px) {
  body {
    padding: 16px;
  }

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

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

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

  .welcome {
    align-items: flex-start;
  }

  .session-badge {
    display: none;
  }
}

@media (max-width: 420px) {
  body {
    padding: 10px;
  }

  .topbar {
    padding-bottom: 15px;
  }

  .brand {
    font-size: 13px;
  }

  .welcome {
    padding: 20px 0 16px;
  }

  .overview-grid {
    gap: 8px;
  }

  .panel {
    padding: 14px;
    border-radius: 11px;
  }

  .big-number {
    font-size: 30px;
  }

  .color-columns {
    gap: 7px;
  }

  .color-column {
    padding: 9px;
  }

  .result-buttons {
    gap: 5px;
  }

  .action-button {
    font-size: 11px;
  }

  footer {
    align-items: flex-start;
  }
}
