:root { --wall:#1d2a26; --wall2:#0f1715; --oak:#6b4423; --oak2:#3d2613; --brass:#c9a24a; --brass2:#8a6a22; --paper:#f4ecd8; --ink:#22201b; --green:#1f4d3a; --red:#8c2f22; --lamp:rgba(255,196,110,.34); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--wall2); color: var(--paper); font-family: Georgia, 'Times New Roman', serif; }
button { font: inherit; cursor: pointer; }
#app { min-height: 100%; display: flex; flex-direction: column; }

/* The photograph carries the room. The controls sit at the edges of the scene. */
.room {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: linear-gradient(180deg, #100d09e8 0%, #100d0924 27%, transparent 61%, #100d09ee 100%),
    var(--plate, none) center 54% / cover no-repeat, #1f211b;
}
.wall { flex: 1; min-height: 51dvh; display: flex; align-items: flex-start; justify-content: space-between; padding: 32px 5vw; gap: 16px; }
.room-heading { max-width: 32rem; text-shadow: 0 2px 12px #110c05; }
.title { margin: 0; font-size: clamp(2rem, 5vw, 4.35rem); font-weight: 400; line-height: .98; letter-spacing: -.04em; color: #fff3db; }
.preview-label { margin: 0 0 12px; font: 700 .69rem/1.3 system-ui, sans-serif; letter-spacing: .2em; text-transform: uppercase; color: #e9c484; }
.frame { flex: none; background: #1c170fe8; border: 1px solid #b48b55; color: #f6e5c6; border-radius: 2px; padding: 10px 14px; text-align: center; box-shadow: 0 6px 22px #100d0988; }
.frame small { display: block; margin-bottom: 3px; letter-spacing: .10em; text-transform: uppercase; font: 650 .62rem/1.3 system-ui, sans-serif; }
.frame b { font-size: 24px; font-weight: 400; }
.desk { padding: 0 5vw calc(24px + env(safe-area-inset-bottom)); }
.objects { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 10px; }
.object {
  text-align: left; border: 1px solid #ab835bbf; border-radius: 2px; padding: 14px 16px;
  color: #fff2d8; background: linear-gradient(155deg, #38291bee, #1c1712f7);
  box-shadow: 0 4px 14px #130d07aa, inset 0 1px 0 #e2ba7830; min-height: 78px; transition: border-color .18s, background-color .18s;
}
.object:hover, .frame:hover { border-color: #ffe1a8; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #b68136; outline-offset: 3px; }
.object b { display: block; margin-bottom: 4px; font-size: 20px; font-weight: 500; }
.object span { display: block; font: .76rem/1.3 system-ui, sans-serif; color: #edd7b9; }
.object.primary { background: linear-gradient(140deg, #f8edcf, #dfc491); border-color: #fff0c0; color: #271c10; }
.object.primary span { color: #5b432d; }

@media (max-width: 650px) {
  .room { background-position: center, 50% center; }
  .wall { min-height: 51dvh; padding: 24px 16px 12px; gap: 10px; }
  .title { font-size: clamp(1.85rem, 7.5vw, 3rem); }
  .preview-label { letter-spacing: .11em; font-size: .6rem; }
  .frame { padding: 8px; }
  .frame small { max-width: 5.5rem; }
  .frame b { font-size: 20px; }
  .desk { padding: 0 13px calc(15px + env(safe-area-inset-bottom)); }
  .objects { grid-template-columns: 1fr 1fr; gap: 8px; }
  .object { padding: 9px 11px; min-height: 61px; }
  .object b { font-size: 17px; }
  .object span { font-size: .68rem; }
}

/* The work surface: one sheet of paper, one decision. */
.work {
  flex: 1; min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  padding: 17px 14px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(#160e0877, #160e0828), var(--worktop, none) center / cover no-repeat, #3b2b1b;
}
.bar { width: 100%; max-width: 650px; display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 7px 9px 7px 13px; background: #241a11e8; color: #f9edd2; border: 1px solid #b48b55a0; border-radius: 3px; font: .79rem/1.35 system-ui, sans-serif; }
.bar .track { flex: 1; height: 6px; background: #110a07; border-radius: 3px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--brass); }
.sheet { width: 100%; max-width: 650px; background: linear-gradient(132deg, #fff5de 0%, #f0e4ca 100%); color: var(--ink); padding: clamp(15px, 4vw, 30px); border: 1px solid #e2c89a; border-radius: 2px; box-shadow: 0 18px 30px #130d09aa, 0 1px 2px #120a04; }
.tag { font: 650 .68rem/1.35 system-ui, sans-serif; letter-spacing: .10em; text-transform: uppercase; color: var(--green); margin-bottom: 6px; }
.stage-label { margin: 0 0 14px; font-size: 14px; font-style: italic; color: #604831; }
.doc { border: 1px solid #b9ad8d; background: #fff9ec; padding: 10px 12px; margin-bottom: 14px; font-family: 'Courier New', monospace; font-size: 14px; }
.doc.review { border-left: 3px solid #53715d; background: #e9ebdd; }
.doc h4 { margin: 0 0 2px; font-family: Georgia, serif; font-size: 16px; }
.doc .kind { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #604b37; margin-bottom: 6px; }
.doc .row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px dotted #c9bd9d; overflow-wrap: anywhere; }
.doc .row:last-child { border-bottom: 0; }
.prompt { font-size: 20px; margin: 0 0 14px; line-height: 1.3; }.options { display: grid; gap: 8px; }
.opt, .btn { border: 1px solid var(--ink); background: transparent; color: var(--ink); padding: 12px 14px; text-align: left; border-radius: 3px; font-size: 16px; }
.opt:hover { background: rgba(0,0,0,.06); }
.opt.right { background: var(--green); color: #fff; border-color: var(--green); }
.opt.wrong { background: var(--red); color: #fff; border-color: var(--red); }
.btn.solid { background: var(--ink); color: var(--paper); text-align: center; }
.btn.brass { background: var(--brass); border-color: var(--brass2); text-align: center; }
.btn:disabled, .opt:disabled { opacity: .55; cursor: default; }
input, select { font: inherit; font-size: 18px; padding: 10px; border: 1px solid var(--ink); background: #fff; color: var(--ink); border-radius: 3px; width: 100%; }
.entry { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: center; margin-bottom: 10px; }
.row-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.row-actions > * { flex: 1; min-width: 120px; }
.note { margin-top: 14px; padding: 10px 12px; border-left: 4px solid var(--brass); background: rgba(201,162,74,.16); font-size: 15px; }
.note.bad { border-color: var(--red); background: rgba(140,47,34,.1); }
.note.good { border-color: var(--green); background: rgba(31,77,58,.1); }

/* Cards laid over the room */
.veil { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 14px; overflow: auto; z-index: 5; }
.card { background: var(--paper); color: var(--ink); max-width: 560px; width: 100%; padding: 22px; border-radius: 3px; max-height: 92dvh; overflow: auto; }
.card h2 { margin: 0 0 10px; font-size: 24px; }
.card h3 { margin: 16px 0 6px; font-size: 16px; }
.card p, .card li { font-size: 15px; line-height: 1.45; }
.card ul { padding-left: 20px; margin: 6px 0; }
.choice { display: block; width: 100%; margin: 6px 0; }
.choice.on { background: var(--green); color: #fff; border-color: var(--green); }
.demo { border: 2px dashed var(--red); padding: 10px; margin: 10px 0; font-size: 14px; }
.lesson { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dotted #c9bd9d; font-size: 14px; }
.pill { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 1px 6px; border-radius: 9px; border: 1px solid currentColor; white-space: nowrap; align-self: center; }
.price { font-size: 28px; margin: 8px 0; }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: slide .25s ease-out; } @keyframes slide { from { transform: translateY(14px); opacity: 0; } } }


/* ---------- Added for the full Rank 1 build: tables, explain cards, modes, exam, certificate ---------- */
.doc .scroll { overflow-x: auto; }
.doc table, .card table, .edu table { border-collapse: collapse; width: 100%; font-size: 14px; }
.doc th, .doc td, .card td, .edu td, .edu th { text-align: left; padding: 4px 8px 4px 0; border-bottom: 1px dotted #c9bd9d; white-space: pre; }
.doc th { font: 650 .68rem/1.3 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #604b37; }
.doc td:not(:first-child), .doc th:not(:first-child) { text-align: right; }
.doc.review p { margin: 0; font-family: Georgia, serif; font-size: 15px; white-space: normal; }
.opt kbd { display: inline-block; min-width: 1.5em; margin-right: 10px; padding: 1px 5px; border: 1px solid currentColor; border-radius: 3px; font: 600 .7rem/1.4 system-ui, sans-serif; text-align: center; opacity: .6; }
.entry.three { grid-template-columns: 1fr 96px 110px; }
@media (max-width: 480px) { .entry.three { grid-template-columns: 1fr 1fr; } .entry.three select:first-child { grid-column: 1 / -1; } }
.btn.quiet { border: 0; text-decoration: underline; font-size: 13px; opacity: .75; text-align: center; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.leave { color: inherit; border-color: currentColor; padding: 4px 10px; }
.btn.on { background: var(--green); color: #fff; border-color: var(--green); }
.timer { font: 600 .9rem/1 system-ui, sans-serif; letter-spacing: .04em; }
.card.explain { max-width: 600px; }
.card .pic { color: var(--green); max-width: 300px; margin: 4px auto 10px; }
.card .pic svg { width: 100%; height: auto; display: block; }
.card .like { padding: 10px 12px; border-left: 4px solid var(--brass); background: rgba(201,162,74,.16); }
.card dl { margin: 12px 0 0; } .card dt { font-weight: 700; margin-top: 10px; } .card dd { margin: 2px 0 0; font-size: 15px; line-height: 1.4; }
.card input, .edu input { margin: 6px 0; }
.demo { border: 2px dashed var(--red); padding: 10px; margin: 10px 0; font-size: 14px; }
.price { font-size: 26px; margin: 8px 0; }
.firm-strip { margin: 10px 0 0; font: 600 .8rem/1.4 system-ui, sans-serif; color: #f6e5c6; }
.site-links { display: flex; gap: 16px; margin: 0 0 10px; font: .78rem/1 system-ui, sans-serif; }
.site-links a, .edu a { color: #f3ddb0; }
.work.plain { background: #efe6d2; }
.work.plain .bar { background: var(--ink); }
/* Education Only: a plain page */
.edu { max-width: 760px; width: 100%; margin: 0 auto; padding: 24px 16px 60px; color: var(--ink); background: var(--paper); min-height: 100dvh; }
.edu a { color: var(--green); }
.edu h1 { margin: 0; font-size: 30px; } .edu h2 { font-size: 19px; margin: 26px 0 6px; } .edu h4 { margin: 16px 0 4px; }
.edu .lesson { align-items: center; padding: 7px 0; font-size: 15px; }
.cert { border: 6px double var(--brass2); padding: 30px 22px; margin: 18px 0; text-align: center; }
.cert h1 { font-size: 32px; margin: 6px 0 14px; } .cert-name { font-size: 28px; font-style: italic; border-bottom: 1px solid var(--ink); display: inline-block; padding: 0 30px 4px; margin: 4px 0 12px; }
.cert.pending { border-style: dashed; }
@media print { .no-print, .veil { display: none !important; } html, body, .edu { background: #fff; } .cert { break-after: page; } }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.card:focus { outline: none; }
