@import url("screen-controls.css");

:root {
  --paper: #fffdf8;
  --ink: #241b17;
  --muted: #6b5f57;
  --line: #b9aa9d;
  --line-soft: #ded3c9;
  --accent: #6f3518;
  --accent-soft: #f2e3ce;
  --shadow: 0 18px 48px rgba(62, 38, 23, 0.13);
}

* { box-sizing: border-box; }
html { background: #e8dfd3; }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at top, #fff8ec, #e8dfd3 52rem);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.2;
}

button { font: inherit; }
button {
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.62rem 0.88rem;
  color: white;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.site-header {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.5rem;
}
.site-header h1 { margin: 0; font-size: clamp(2rem, 5vw, 3rem); line-height: 1; }
.eyebrow { margin: 0 0 0.22rem; color: var(--accent); font-size: 0.69rem; font-weight: 900; letter-spacing: 0.115em; text-transform: uppercase; }
.lede { margin: 0.4rem 0 0; color: var(--muted); }

.sheet-shell { width: min(8.5in, calc(100% - 1.5rem)); margin: 0 auto 3rem; }
.playtest-sheet {
  position: relative;
  width: 8.5in;
  min-height: 11in;
  padding: 0.28in 0.36in 0.42in;
  background: var(--paper);
  border: 1px solid #d7cbbd;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.sheet-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.28in;
  gap: 0.2in;
  align-items: stretch;
  padding-bottom: 0.075in;
  margin-bottom: 0.055in;
  border-bottom: 3px solid var(--accent);
}
.title-copy { align-self: end; }
.sheet-title h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 21.5pt; line-height: 0.98; }
.title-copy > p:last-child { margin: 0.045in 0 0; color: var(--muted); font-size: 7.7pt; }

.session-code {
  display: grid;
  grid-template-columns: 0.76in minmax(0, 1fr);
  gap: 0.09in;
  align-items: center;
  min-height: 0.76in;
  padding: 0.055in 0.065in;
  border: 1.25px solid var(--line);
  border-radius: 6px;
  background: #fffaf2;
}
.qr-frame {
  display: grid;
  place-items: center;
  width: 0.7in;
  height: 0.7in;
  border: 1.2px solid var(--ink);
  background:
    linear-gradient(45deg, transparent 46%, #e8ded2 47% 53%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, #e8ded2 47% 53%, transparent 54%),
    white;
  color: var(--muted);
  font-size: 6.6pt;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
}
.qr-frame.has-code { background: white; }
.qr-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.qr-frame img[hidden] { display: none; }
.serial-copy { min-width: 0; }
.serial-copy span,
.serial-copy small { display: block; color: var(--muted); font-size: 6.3pt; font-weight: 700; }
.serial-copy strong { display: block; margin: 0.02in 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 8.3pt; letter-spacing: 0.025em; white-space: nowrap; }

h3 {
  margin: 0 0 0.045in;
  color: var(--accent);
  font-size: 9.7pt;
  line-height: 1.08;
}
h3 span { color: var(--muted); font-size: 7.1pt; font-weight: 600; }

.ruled-section { margin-top: 0.072in; }
.meta-section,
.outcome-section,
.ratings-section,
.warning-section { padding-top: 0.01in; }

.meta-grid {
  display: grid;
  grid-template-columns: 0.82fr 1.45fr 1fr;
  gap: 0.1in;
}
.time-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.1in;
  margin-top: 0.05in;
}
.line-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 0.055in;
  min-width: 0;
  color: #4e423a;
  font-size: 7.65pt;
  font-weight: 800;
}
.line-field.short { grid-template-columns: auto minmax(0, 1fr) auto; }
.line-field.stat { min-width: 0.64in; }
.line-field.wide-stat { min-width: 1.1in; }
.write-line {
  display: block;
  min-height: 0.18in;
  border-bottom: 1.35px solid var(--ink);
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.035in 0.095in;
  color: #4e423a;
  font-size: 7.45pt;
}
.choice-row strong { color: var(--accent); }
.choice-row.compact { gap: 0.03in 0.078in; }
.test-types { margin-top: 0.05in; }
.choice {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.035in;
  line-height: 1.12;
}
.choice.prepared { margin-left: auto; font-weight: 800; word-spacing: 0.025in; }
.choice.prepared b { color: var(--muted); }
.paper-box,
.paper-circle {
  display: inline-block;
  width: 0.13in;
  height: 0.13in;
  flex: 0 0 0.13in;
  margin-top: 0.002in;
  border: 1.25px solid var(--ink);
  background: white;
}
.paper-circle { border-radius: 50%; }

.players-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.1in;
}
.player-card {
  border: 1.2px solid var(--line);
  border-radius: 6px;
  padding: 0.065in 0.085in;
  background: #fffaf2;
}
.player-card .line-field + .line-field { margin-top: 0.035in; }
.player-card .choice-row { margin-top: 0.045in; }
.player-a h3::before,
.player-b h3::before { content: "●"; margin-right: 0.045in; color: var(--accent); }
.player-b h3::before { color: #405d77; }
.onboarding-row { padding-top: 0.025in; border-top: 1px dotted var(--line); }

.outcome-top {
  display: grid;
  grid-template-columns: 1fr 1.17fr 0.55fr 0.55fr 0.9fr;
  gap: 0.075in;
  align-items: end;
}
.completion-types,
.victory-routes { margin-top: 0.048in; }

.ratings-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 7.45pt;
}
.ratings-table th,
.ratings-table td {
  border: 1px solid var(--line);
  padding: 0.037in 0.045in;
  vertical-align: middle;
}
.ratings-table th {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 850;
  text-align: left;
}
.ratings-table th:nth-child(1),
.ratings-table th:nth-child(4) { width: 25%; }
.ratings-table th:nth-child(2),
.ratings-table th:nth-child(3),
.ratings-table th:nth-child(5),
.ratings-table th:nth-child(6) { width: 12.5%; text-align: center; }
.ratings-table td:nth-child(2),
.ratings-table td:nth-child(3),
.ratings-table td:nth-child(5),
.ratings-table td:nth-child(6) { text-align: center; }
.rating-scale {
  display: block;
  word-spacing: 0.06in;
  white-space: nowrap;
  font-size: 8.45pt;
  font-weight: 800;
  letter-spacing: 0.005in;
}

.warning-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.035in 0.15in;
  font-size: 7.4pt;
}

.feedback-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.09in 0.1in;
  margin-top: 0.085in;
}
.feedback-grid article { min-width: 0; }
.feedback-grid h3 { min-height: 0.25in; font-size: 8.45pt; }
.writing-box {
  height: 1.26in;
  border: 1.15px solid var(--line);
  border-radius: 4px;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 0.21in,
      var(--line-soft) 0.21in,
      var(--line-soft) 0.22in
    ),
    white;
}

.sheet-footer {
  position: absolute;
  left: 0.36in;
  right: 0.36in;
  bottom: 0.14in;
  display: flex;
  justify-content: space-between;
  gap: 0.18in;
  padding-top: 0.045in;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 6.3pt;
}

@media (max-width: 900px) {
  .site-header { display: grid; align-items: start; }
  .sheet-shell { width: calc(100% - 1rem); overflow-x: auto; }
}

@media print {
  @page { size: Letter portrait; margin: 0; }
  html, body { background: white; }
  body { font-family: "Noto Sans", Arial, sans-serif; }
  .screen-only { display: none !important; }
  .sheet-shell { width: auto; margin: 0; }
  .playtest-sheet {
    width: 8.5in;
    height: 11in;
    min-height: 11in;
    margin: 0;
    padding: 0.28in 0.36in 0.42in;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
  }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
