:root {
  --wood-dark: #241812;
  --wood-mid: #3d2818;
  --wood-light: #5a3a22;
  --felt: #0f2e22;
  --felt-light: #164436;
  --brass: #c9a35a;
  --brass-bright: #e8c878;
  --chalk: #f2ead6;
  --chalk-dim: #b9c9bd;
  --slate: #16221b;
  --slate-light: #1f3126;
  --red: #a8342c;
  --green: #1f6f4a;
  --board-black: #181614;
  --board-cream: #e9dfc4;
  --success: #5fbf76;
  --fail: #d15b4f;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100%;
}
body {
  background:
    radial-gradient(ellipse at 50% -10%, #3a2a1c 0%, var(--wood-dark) 55%),
    var(--wood-dark);
  color: var(--chalk);
  font-family: "Inter", sans-serif;
  min-height: 100vh;
  padding: 28px 20px 60px;
}
.wrap {
  max-width: 1180px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 28px;
}
header h1 {
  font-family: "Kalam", cursive;
  font-size: 44px;
  margin: 0;
  color: var(--chalk);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}
header p {
  font-family: "Inter", sans-serif;
  color: var(--chalk-dim);
  font-size: 14px;
  margin: 8px 0 0;
}

.layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- BOARD CABINET ---------- */
.cabinet {
  background: radial-gradient(
    circle at 50% 42%,
    var(--wood-light) 0%,
    var(--wood-mid) 55%,
    var(--wood-dark) 100%
  );
  border-radius: 24px;
  padding: 26px;
  box-shadow:
    inset 0 0 0 2px rgba(201, 163, 90, 0.25),
    inset 0 0 60px rgba(0, 0, 0, 0.55),
    0 20px 40px rgba(0, 0, 0, 0.5);
  position: relative;
  flex: 0 0 auto;
  width: min(600px, 92vw);
}
.felt-ring {
  background: radial-gradient(
    circle at 50% 45%,
    var(--felt-light) 0%,
    var(--felt) 70%
  );
  border-radius: 50%;
  padding: 14px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
}
svg#board {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
  touch-action: manipulation;
}
path[data-score],
circle[data-score] {
  cursor: pointer;
  transition:
    filter 0.08s ease,
    opacity 0.08s ease;
}
path[data-score]:hover,
circle[data-score]:hover {
  filter: brightness(1.35);
}
path[data-score]:focus,
circle[data-score]:focus {
  outline: none;
  filter: brightness(1.4) drop-shadow(0 0 4px var(--brass-bright));
}
.board-disabled path[data-score],
.board-disabled circle[data-score] {
  cursor: not-allowed;
}

/* ---------- SIDE PANEL ---------- */
.side {
  flex: 1 1 380px;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.scorepanel {
  background: linear-gradient(180deg, var(--slate-light), var(--slate));
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow:
    inset 0 0 0 1px rgba(201, 163, 90, 0.2),
    0 12px 24px rgba(0, 0, 0, 0.4);
}
.scorepanel .target-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.scorepanel .label {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--chalk-dim);
}
.scorepanel .target-num {
  font-family: "Kalam", cursive;
  font-size: 52px;
  line-height: 1;
  color: var(--brass-bright);
}
.scorepanel .remaining-num {
  font-family: "Kalam", cursive;
  font-size: 52px;
  line-height: 1;
  color: var(--chalk);
}
.darts-row {
  display: flex;
  gap: 10px;
  margin: 14px 0;
}
.dart-slot {
  flex: 1;
  height: 52px;
  border-radius: 10px;
  border: 1.5px dashed rgba(242, 234, 214, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Mono", monospace;
  font-size: 15px;
  color: var(--chalk-dim);
  background: rgba(0, 0, 0, 0.15);
}
.dart-slot.filled {
  border-style: solid;
  border-color: var(--brass);
  color: var(--brass-bright);
  background: rgba(201, 163, 90, 0.1);
  font-weight: 700;
}
.message {
  min-height: 26px;
  font-family: "Kalam", cursive;
  font-size: 19px;
  margin: 6px 0 14px;
}
.message.success {
  color: var(--success);
}
.message.fail {
  color: var(--fail);
}
.message.info {
  color: var(--chalk-dim);
  font-family: "Inter", sans-serif;
  font-size: 13.5px;
}

.hint-box {
  font-family: "Space Mono", monospace;
  font-size: 13px;
  color: var(--brass);
  background: rgba(201, 163, 90, 0.08);
  border: 1px solid rgba(201, 163, 90, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  display: none;
}
.hint-box.show {
  display: block;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
button {
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 13px;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  transition:
    transform 0.08s ease,
    filter 0.08s ease;
}
button:active {
  transform: scale(0.96);
}
.btn-primary {
  background: var(--brass);
  color: #241812;
}
.btn-primary:hover {
  filter: brightness(1.1);
}
.btn-ghost {
  background: transparent;
  color: var(--chalk);
  border: 1px solid rgba(242, 234, 214, 0.3);
}
.btn-ghost:hover {
  background: rgba(242, 234, 214, 0.08);
}

/* ---------- CHALKBOARD LIST ---------- */
.chalkboard {
  background: radial-gradient(ellipse at 50% 0%, #24352a 0%, var(--slate) 70%);
  border-radius: 16px;
  box-shadow:
    inset 0 0 0 1px rgba(201, 163, 90, 0.2),
    inset 0 0 40px rgba(0, 0, 0, 0.4),
    0 12px 24px rgba(0, 0, 0, 0.4);
  padding: 18px 10px 18px 18px;
}
.chalkboard h2 {
  font-family: "Kalam", cursive;
  font-size: 20px;
  margin: 0 12px 12px 0;
  color: var(--chalk);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chalkboard h2 span.sub {
  font-family: "Space Mono", monospace;
  font-size: 10px;
  color: var(--chalk-dim);
  letter-spacing: 0.1em;
  text-transform: none;
}
.checkout-list {
  min-width: 0; /* allows the grid to actually shrink */
  max-height: 440px;
  overflow-y: auto;
  padding-right: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}
.checkout-list::-webkit-scrollbar {
  width: 8px;
}
.checkout-list::-webkit-scrollbar-thumb {
  background: rgba(201, 163, 90, 0.4);
  border-radius: 4px;
}
.co-item {
  min-width: 0; /* flex/grid children ignore min-width:auto by default otherwise */
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(242, 234, 214, 0.08);
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: "Space Mono", monospace;
  transition:
    background 0.1s ease,
    border-color 0.1s ease;
}
.co-item:hover {
  background: rgba(201, 163, 90, 0.12);
  border-color: rgba(201, 163, 90, 0.4);
}
.co-item.active {
  background: rgba(201, 163, 90, 0.22);
  border-color: var(--brass);
}
.co-score {
  font-weight: 700;
  font-size: 15px;
  color: var(--brass-bright);
  min-width: 30px;
}
.co-route {
  white-space: normal; /* let it wrap instead of forcing width */
  overflow-wrap: break-word;
  font-size: 10.5px;
  color: var(--chalk-dim);
  text-align: right;
}

footer {
  text-align: center;
  color: var(--chalk-dim);
  font-size: 12px;
  margin-top: 36px;
  font-family: "Inter", sans-serif;
}

footer .social-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
}
footer .social-links a {
  color: var(--chalk-dim);
  display: inline-flex;
  transition: color 0.15s ease;
}
footer .social-links a:hover,
footer .social-links a:focus {
  color: var(--brass-bright);
}

#privacy {
  text-align: left;
}

.contact-email {
  display: inline-block;
}

.text-right {
  text-align: right;
}

#privacy a,
.support-section a {
  color: var(--brass-bright);
  text-decoration: underline;
}
#privacy a:visited,
.support-section a:visited {
  color: var(--brass-bright);
}
#privacy a:hover,
#privacy a:focus,
.support-section a:hover,
.support-section a:focus {
  color: var(--chalk);
}

.ad-slot {
  background: rgba(0, 0, 0, 0.15);
  border: 1px dashed rgba(201, 163, 90, 0.25);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.support-section {
  max-width: 1180px;
  margin: 0 auto 20px;
  padding: 16px 22px;
  background: #16221b;
  border: 1px solid rgba(242, 234, 214, 0.08);
  border-radius: 12px;
}
.support-section h2 {
  font-family: "Kalam", cursive;
  font-size: 20px;
  margin: 0 0 8px;
}
.support-section .disclosure {
  font-size: 11px;
  color: var(--chalk-dim);
}

.guide-section {
  max-width: 1180px;
  margin: 32px auto 20px;
  padding: 20px 24px;
  background: #16221b;
  border: 1px solid rgba(242, 234, 214, 0.08);
  border-radius: 12px;
  text-align: left;
  color: var(--chalk-dim);
  font-family: "Inter", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
.guide-section h2 {
  font-family: "Kalam", cursive;
  font-size: 22px;
  color: var(--chalk);
  margin: 0 0 12px;
}
.guide-section h3 {
  font-family: "Inter", sans-serif;
  font-size: 15px;
  color: var(--brass-bright);
  margin: 20px 0 8px;
}
.guide-section p {
  margin: 0 0 10px;
}
.guide-section ul {
  margin: 0 0 10px 20px;
  padding: 0;
}
.guide-section li {
  margin: 0 0 8px;
}
/* .kofi-button {
  display: inline-block;
  background: var(--brass);
  color: #241812;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  margin-top: 8px;
} */

@media (max-width: 760px) {
  header h1 {
    font-size: 32px;
  }
  .scorepanel .target-num,
  .scorepanel .remaining-num {
    font-size: 38px;
  }
  /* Trim the wooden chrome around the board so more of the small
    screen goes to the board itself — the double/treble rings are
     already thin, every extra px of diameter helps. */
  body {
    padding: 20px 12px 60px;
  }
  .cabinet {
    padding: 12px;
    width: min(600px, 97vw);
  }
  .felt-ring {
    padding: 6px;
  }
}

/* Ko-fi's floating button defaults to bottom-left. On mobile only, move it
  to bottom-right instead. The wrapper's ~180px width isn't a fixed
  property of its own — it's derived from having both a left AND an
  implicit right-side constraint set at once, with no in-flow content
  (its only child is position:absolute, which doesn't count toward
  shrink-to-fit sizing). Overriding "left" alone collapses that width to
  0 and pushes the button off-screen — happened here on the first
  attempt. Declaring the width explicitly ourselves avoids that.
  The 31px (not a plain 16px mirror of the left margin) accounts for the
  real button being 195px wide inside this 180px box — it always
  overflows its own box by 15px, rightward, regardless of which side the
  box is anchored from — so matching the left side's true 16px visual
   clearance from the screen edge needs 16 + 15 = 31px here. */
@media (max-width: 600px) {
  .floatingchat-container-wrap-mobi,
  .floatingchat-container-wrap {
    left: auto !important;
    right: 1px !important;
    width: 180px !important;
  }
}

/* ---------- ADD TO HOME SCREEN PROMPT ---------- */
.install-prompt-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.install-prompt-overlay.show {
  display: flex;
}
.install-prompt-card {
  position: relative;
  background: linear-gradient(180deg, var(--slate-light), var(--slate));
  border-radius: 16px;
  box-shadow:
    inset 0 0 0 1px rgba(201, 163, 90, 0.25),
    0 20px 50px rgba(0, 0, 0, 0.5);
  padding: 28px 24px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
}
.install-prompt-card h2 {
  font-family: "Kalam", cursive;
  font-size: 24px;
  color: var(--chalk);
  margin: 0 0 12px;
}
.install-prompt-card p {
  font-family: "Inter", sans-serif;
  font-size: 14px;
  color: var(--chalk-dim);
  line-height: 1.6;
  margin: 0 0 18px;
}
.install-prompt-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--chalk-dim);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
}
.install-prompt-close:hover {
  color: var(--chalk);
}
.install-prompt-btn {
  width: 100%;
}
