/* PARDLE — styles.css */
:root {
  --bg0: #0b0d16;
  --bg1: #161a2b;
  --ink: #f4f6ff;
  --muted: #8b93b5;
  --good: #7cfc6a;
  --bad: #ff6a5a;
  --gold: #ffd23f;
  --panel: #1b2036;
  --panel2: #232a45;
  --line: #2f3960;
  --accent: #5aa83a;
  --accent2: #74c24a;
  --font: "Press Start 2P", ui-monospace, "Courier New", monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.hidden {
  display: none !important;
}
html,
body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(120% 80% at 50% 0%, #1d2440 0%, var(--bg0) 60%);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

/* HUD */
#hud {
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 4px;
  padding: 10px 8px 8px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), transparent);
}
.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 48px;
}
.hud-l {
  font-size: 6px;
  letter-spacing: 1px;
  color: var(--muted);
}
.hud-v {
  font-size: 13px;
  color: var(--ink);
}
.hud-v.good {
  color: var(--good);
}
.hud-v.bad {
  color: var(--bad);
}

/* Stage / canvas */
#stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 4px;
}
#game {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  border-radius: 3px;
  box-shadow:
    0 0 0 2px #000,
    0 6px 0 2px rgba(0, 0, 0, 0.45),
    0 10px 40px rgba(0, 0, 0, 0.5);
  cursor: crosshair;
  touch-action: none;
}

/* Banner (BIRDIE! etc.) */
.banner {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  font-size: min(20px, calc(var(--canvas-w, 180px) / 13));
  max-width: var(--canvas-w, 180px);
  padding: 10px 16px;
  color: #fff;
  text-shadow: 0 2px 0 #000, 0 0 12px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  animation: pop 0.35s ease-out;
  text-align: center;
  white-space: nowrap;
}
.banner.ace {
  color: var(--gold);
}
.banner.eagle,
.banner.birdie {
  color: var(--good);
}
.banner.par {
  color: #fff;
}
.banner.bogey,
.banner.dbogey,
.banner.bad {
  color: var(--bad);
}
@keyframes pop {
  0% {
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
  }
  60% {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Toast */
.toast {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid var(--line);
  padding: 7px 12px;
  font-size: 8px;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
  animation: toastIn 0.22s ease-out;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Pick-up (concede) button — floats over the stage when a hole runs long */
.skip-btn {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  font-family: var(--font);
  font-size: 8px;
  color: var(--ink);
  background: rgba(10, 12, 20, 0.82);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 14px;
  cursor: pointer;
  z-index: 6;
  white-space: nowrap;
  animation: toastIn 0.22s ease-out;
}
.skip-btn:active {
  transform: translateX(-50%) translateY(1px);
}

/* Footer */
#footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  position: relative;
}
#hint {
  font-size: 7px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}
.icon-btn {
  position: absolute;
  right: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  cursor: pointer;
}

/* Screens / modals */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 8, 16, 0.86);
  backdrop-filter: blur(2px);
  z-index: 10;
  animation: fade 0.2s ease-out;
  overflow-y: auto;
}
.screen.hidden {
  display: none;
}
@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.panel {
  width: 100%;
  max-width: 340px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.4), 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* Title */
.logo {
  font-size: 38px;
  margin: 6px 0 4px;
  color: var(--accent2);
  text-shadow: 0 3px 0 #1c5a14, 0 4px 0 #0c3a08, 4px 4px 0 rgba(0, 0, 0, 0.4);
  letter-spacing: 2px;
}
.logo span {
  color: #fff;
  text-shadow: 0 3px 0 #555, 4px 4px 0 rgba(0, 0, 0, 0.4);
}
.tagline {
  font-size: 8px;
  color: var(--gold);
  letter-spacing: 3px;
  margin: 0 0 14px;
}
.day {
  font-size: 9px;
  color: var(--muted);
  margin: 0 0 6px;
}
.title-theme {
  font-size: 9px;
  color: var(--gold);
  letter-spacing: 1px;
  margin: 0 0 16px;
  min-height: 10px;
}
.streak {
  font-size: 9px;
  color: var(--gold);
  margin: 14px 0 4px;
  min-height: 12px;
}
.foot {
  font-size: 6px;
  color: var(--muted);
  line-height: 1.6;
  margin: 10px 0 0;
}

/* Buttons */
.btn-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-row {
  display: flex;
  gap: 10px;
}
.btn-row .btn {
  flex: 1;
}
.btn {
  font-family: var(--font);
  font-size: 11px;
  color: var(--ink);
  background: var(--panel2);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 7px;
  padding: 13px 12px;
  cursor: pointer;
  transition: transform 0.05s, background 0.1s;
}
.btn:hover {
  background: #2b3458;
}
.btn:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}
.btn-primary {
  background: linear-gradient(180deg, var(--accent2), var(--accent));
  border-color: #2c6a1e;
  color: #07230a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #82d156, var(--accent2));
}
.btn-sm {
  font-size: 8px;
  padding: 11px 8px;
}

/* Headings */
.h2 {
  font-size: 16px;
  margin: 2px 0 12px;
  color: var(--accent2);
}
.h3 {
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 1px;
  margin: 16px 0 8px;
}

/* How to */
.howto {
  text-align: left;
  font-size: 8px;
  line-height: 1.9;
  color: #d6dcf5;
  padding-left: 16px;
  margin: 0 0 18px;
}
.howto b {
  color: var(--gold);
}

/* Results */
.res-sub {
  font-size: 11px;
  margin: 0 0 8px;
}
.res-sub.good {
  color: var(--good);
}
.res-sub.bad {
  color: var(--bad);
}
.res-streak {
  font-size: 10px;
  color: var(--gold);
  margin: 0 0 12px;
}
.res-flavor {
  font-size: 7px;
  color: var(--muted);
  letter-spacing: 1px;
  margin: 0 0 12px;
}
.res-social {
  font-size: 8px;
  color: #9fb4ff;
  margin: 0 0 12px;
  line-height: 1.6;
}
.res-social b {
  color: var(--gold);
}
.scorecard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  margin: 0 auto 14px;
}
.cc-cell {
  background: var(--panel2);
  border-radius: 3px;
  padding: 8px 2px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cc-cell.cc-h {
  background: transparent;
  color: var(--muted);
  font-size: 7px;
  padding: 4px 0;
}
.cc-cell.cc-lbl {
  color: var(--muted);
  font-size: 7px;
}
.cc-cell.good {
  color: var(--good);
}
.cc-cell.bad {
  color: var(--bad);
}
.cc-cell.ace {
  color: var(--gold);
  background: #3a3415;
}
.share-text {
  font-family: var(--font);
  font-size: 9px;
  line-height: 1.7;
  background: var(--bg0);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  margin: 0 0 12px;
  white-space: pre-wrap;
  text-align: left;
  color: #e8ecff;
}
.share-card-wrap {
  display: flex;
  justify-content: center;
  margin: 4px 0 14px;
  min-height: 40px;
}
.share-card-img {
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.4), 0 12px 30px rgba(0, 0, 0, 0.55);
}
.share-status {
  font-size: 7px;
  color: var(--good);
  min-height: 10px;
  margin: 0 0 8px;
}
.countdown {
  font-size: 8px;
  color: var(--muted);
  margin: 0 0 12px;
}
.countdown span {
  color: var(--gold);
}

/* Stats */
.stats-top {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.stats-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.stat {
  background: var(--panel2);
  border-radius: 5px;
  padding: 10px 4px;
}
.stat-v {
  font-size: 16px;
  color: var(--ink);
}
.stat-l {
  font-size: 6px;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.stats-bars {
  margin-bottom: 18px;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}
.bar-lbl {
  font-size: 7px;
  width: 64px;
  text-align: left;
  color: var(--muted);
}
.bar-track {
  flex: 1;
  background: var(--bg0);
  border-radius: 3px;
  height: 14px;
  display: flex;
  align-items: center;
}
.bar-fill {
  height: 14px;
  border-radius: 3px;
  background: #46507e;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 4px;
  font-size: 7px;
  color: #fff;
  min-width: 8px;
}
.bar-fill.good {
  background: var(--accent);
}
.bar-fill.bad {
  background: #b5483c;
}

@media (max-height: 560px) {
  .logo {
    font-size: 28px;
  }
  .panel {
    padding: 16px 14px;
  }
}

/* Leaderboard */
.lb-sub {
  font-size: 8px;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.5;
}
.lb-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  text-align: left;
}
.lb-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 5px;
  background: var(--panel2);
  margin-bottom: 4px;
  font-size: 9px;
}
.lb-rank {
  width: 26px;
  text-align: center;
  flex: none;
}
.lb-name2 {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-score {
  flex: none;
}
.lb-score.good {
  color: var(--good);
}
.lb-score.bad {
  color: var(--bad);
}
.lb-empty {
  justify-content: center;
  color: var(--muted);
}
.lb-you {
  font-size: 9px;
  color: var(--gold);
  min-height: 12px;
  margin: 0 0 12px;
}
.lb-name {
  margin: 0 0 14px;
}
.lb-name-row {
  display: flex;
  gap: 8px;
}
.lb-name-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font);
  font-size: 9px;
  color: var(--ink);
  background: var(--bg0);
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}
.lb-note {
  font-size: 6px;
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.5;
}

/* Accessibility: visible focus + reduced motion */
.btn:focus-visible,
.icon-btn:focus-visible,
#game:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .banner,
  .toast,
  .screen {
    animation: none !important;
  }
}
