/* shelfguessr — GeoGuessr, but the map is your SimCluster and the location is
   a bookshelf. Warm reading-room palette: cream paper, deep forest green,
   a gold "pin" accent for the guessing grid. */

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono.ttf") format("truetype");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --paper: #f4ecd8;
  --paper-dark: #e6dabd;
  --ink: #2c2416;
  --ink-soft: #5a4d38;
  --forest: #234d38;
  --forest-dark: #16332a;
  --gold: #c9922e;
  --gold-bright: #e8b64a;
  --wrong: #a5382e;
  --right: #2f6e42;
  --card: #fffaf0;
  --border: #d8c9a3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 10% 10%, var(--paper-dark) 0%, transparent 40%),
    radial-gradient(circle at 90% 85%, var(--paper-dark) 0%, transparent 40%);
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  line-height: 1.5;
}

a { color: var(--forest); }
a:hover { color: var(--gold); }

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

h1.wordmark {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.5px;
  color: var(--forest-dark);
}
h1.wordmark a { color: inherit; text-decoration: none; }
h1.wordmark sup {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: normal;
}

nav.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
nav.tabs a {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink-soft);
  background: var(--card);
  font-size: 13px;
}
nav.tabs a.active {
  color: #fff;
  background: var(--forest);
  border-color: var(--forest);
}

.session-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
.session-bar button, .btn {
  font-family: inherit;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--forest);
  background: var(--forest);
  color: #fff;
  cursor: pointer;
}
.session-bar button:hover, .btn:hover { background: var(--forest-dark); }
.btn.secondary {
  background: var(--card);
  color: var(--forest);
  border-color: var(--border);
}
.btn.secondary:hover { background: var(--paper-dark); color: var(--forest-dark); }
.btn:disabled { opacity: 0.5; cursor: default; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 18px;
}

.lede {
  color: var(--ink-soft);
  font-size: 14px;
  margin: -6px 0 20px;
}
.lede a { color: var(--forest); }

label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
input[type="text"], textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; min-height: 70px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 160px; }

.hint { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.err { color: var(--wrong); font-size: 13px; margin-top: 8px; }
.status { color: var(--ink-soft); font-size: 13px; margin-top: 8px; }

.shelf-photo-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--paper-dark);
  margin-bottom: 16px;
}
.shelf-photo-wrap img {
  display: block;
  width: 100%;
  max-height: 480px;
  object-fit: cover;
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding: 2px;
}
.candidate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  color: var(--ink);
}
.candidate:hover { border-color: var(--gold); background: #fff8e8; }
.candidate:disabled { cursor: default; }
.candidate img {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper-dark);
}
.candidate.correct { border-color: var(--right); background: #eaf6ec; }
.candidate.wrong { border-color: var(--wrong); background: #fbeae8; opacity: 0.85; }
.candidate.answer { border-color: var(--right); box-shadow: 0 0 0 2px var(--right) inset; }

.result-banner {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 14px;
}
.result-banner.correct { background: #e4f4e6; color: var(--right); border: 1px solid var(--right); }
.result-banner.wrong { background: #fbe9e7; color: var(--wrong); border: 1px solid var(--wrong); }

.score-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--gold);
  color: #3a2a05;
  font-size: 12px;
  font-weight: bold;
}

table.standings {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.standings th, table.standings td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
table.standings th { color: var(--ink-soft); font-weight: normal; font-size: 12px; }
table.standings tr:first-child td { font-weight: bold; }
table.standings img { width: 24px; height: 24px; border-radius: 50%; vertical-align: middle; margin-right: 8px; object-fit: cover; }

.upload-preview {
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  margin: 10px 0;
}

footer.site {
  margin-top: 30px;
  font-size: 12px;
  color: var(--ink-soft);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
footer.site a { color: var(--ink-soft); }
footer.site a:hover { color: var(--forest); }

.empty-state { text-align: center; padding: 30px 10px; color: var(--ink-soft); }

.share-card { margin-top: 14px; }
#shareCanvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.share-actions .btn { text-decoration: none; display: inline-flex; align-items: center; }
