/* The paper look: the travel game's paper, colours and lettering on the
 * lesson screen (html.look-paper, set in index.html from ?look=paper).
 *
 * A trial beside the default dark look. It covers the lesson screen:
 * header, chapter strip, conversation, phrase card, Your turn box and
 * the message box. Panels opened from the header take the variable
 * colours and are not yet finished in this look.
 *
 * Lettering: the hand font is for Spanish being taught, names and
 * titles. Explanations and what the learner types stay in the plain
 * font, because that is the text read most. */

html.look-paper {
  --bg: #efe4cc;
  --bg-elev: #f6efe0;
  --bg-chat: #f3ead6;
  --border: #cdbb98;
  --text: #2b2233;
  --muted: #5f5247;
  --tutor: #a83c2d;
  --you: #266b67;
  --accent: #a63a2b;
  --accent-hover: #8f3023;
  --ok: #38632c;
  --warn: #7a5209;
  --danger: #9e2f28;
  --energy: #a31b53;
  --ink: #2b2233;
  --gold: #e9b44c;
  --hand: "Patrick Hand", "Chalkboard SE", "Comic Sans MS", sans-serif;
  --brush: "Caveat Brush", "Marker Felt", "Chalkboard SE", cursive;
  color-scheme: light;
}

/* Paper: a warm sheet with faint grain and a pooled wash in one corner. */
html.look-paper body {
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(233, 180, 76, 0.22), transparent 62%),
    radial-gradient(700px 480px at 100% 100%, rgba(63, 143, 138, 0.12), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .17 0 0 0 0 .13 0 0 0 0 .2 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--bg);
  color: var(--text);
}

/* ---------------------------------------------------------------- header */
/* The header sits on the painted landscape at the top of the lesson panel
 * instead of taking its own band above it. The page measures the header
 * (--top-h, app.js) and the panel reserves that much at its top. */
html.look-paper .top {
  position: relative;
  z-index: 4;
  background: transparent;
  border-bottom: none;
  padding: 0.55rem 0.85rem;
  margin: 0 1px calc(-1 * var(--top-h, 0px));
}
html.look-paper .main { margin-top: 0; }
html.look-paper .top h1 { font-family: var(--brush); font-weight: 400; font-size: 1.7rem; line-height: 1; color: var(--ink); }
html.look-paper .top .sub { color: var(--muted); }
html.look-paper .logo { border: 2px solid var(--ink); border-radius: 12px 14px 11px 15px; box-shadow: 0 2px 0 var(--ink); }
html.look-paper .btn {
  background: var(--bg-elev);
  color: var(--ink);
  border: 1.5px solid var(--border);
  border-radius: 14px 12px 15px 12px / 12px 15px 12px 14px;
  box-shadow: 0 2px 0 var(--border);
}
html.look-paper .btn.ghost { background: var(--bg-elev); }
html.look-paper .btn:hover { background: #fff8e8; }
html.look-paper .btn.primary {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 2px 0 var(--ink);
  font-weight: 600;
}
html.look-paper .btn.primary:hover { background: #f3c661; }
html.look-paper .btn.primary:disabled { opacity: 0.5; }
html.look-paper .meter-chip {
  background: var(--bg-elev);
  color: var(--energy);
  border: 1.5px solid var(--border);
  border-radius: 14px 12px 15px 12px / 12px 15px 12px 14px;
  box-shadow: 0 2px 0 var(--border);
}
html.look-paper .meter-chip:hover { background: #fff8e8; border-color: var(--energy); }
html.look-paper .meter-chip.low,
html.look-paper .meter-chip.full,
html.look-paper .meter-chip.empty {
  background: #fdf0f5;
  color: var(--energy);
  border-color: var(--energy);
  border-style: dashed;
  border-width: 2px;
  box-shadow: none;
}
html.look-paper .more-menu,
html.look-paper .flyout,
html.look-paper .card { background: var(--bg-elev); color: var(--ink); border-color: var(--border); }
html.look-paper .more-item { color: var(--ink); }
html.look-paper .more-item:hover { background: #fff2cf; }

/* ---------------------------------------------------- chapter strip */
/* Today's chapter over the painted landscape of the country it opens. */
html.look-paper .chat-panel {
  padding-top: var(--top-h, 0px);
  background: var(--bg-chat);
  border-color: var(--border);
  box-shadow: 0 10px 26px rgba(43, 34, 51, 0.14);
}
/* The landscape band: header plus the "Today" tag. Its own layer so the
 * picture crops to the band, not to the whole panel; the chat below
 * (positioned, opaque) covers anything past it. */
html.look-paper .chat-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: calc(var(--top-h, 0px) + 3.6rem);
  background: var(--strip, none) 0% 22% / 135% auto no-repeat, #d9c9a4;
  animation: strip-drift 110s ease-in-out infinite alternate;
}
/* Below the landscape band everything is the plain chat paper. */
html.look-paper .chat-stage { background: var(--bg-chat); }
html.look-paper .chat-stage { border-top: 1.5px solid var(--border); }
html.look-paper .detour-bar { top: var(--top-h, 0px); }
html.look-paper .sitting-bar {
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 0.1rem 0.9rem 0.6rem;
  background: transparent;
  border-bottom: none;
}
html.look-paper .sitting-bar #sittingLine {
  font-family: var(--brush);
  font-size: 1.35rem;
  line-height: 1.1;
  color: var(--ink);
  background: var(--bg-elev);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.12rem 0.8rem 0.2rem;
  transform: rotate(-1.2deg);
  box-shadow: 0 4px 10px rgba(43, 34, 51, 0.2);
}

/* ----------------------------------------------------- conversation */
html.look-paper .bubble.tutor,
html.look-paper .bubble.you {
  color: var(--ink);
  border: 1.5px solid var(--border);
  border-radius: 9px 13px 10px 14px / 13px 9px 14px 10px;
  box-shadow: 0 2px 0 rgba(43, 34, 51, 0.1), 0 8px 18px rgba(43, 34, 51, 0.12);
}
html.look-paper .bubble.tutor { background: var(--bg-elev); }
html.look-paper .bubble.you { background: #e3efe2; border-color: #a9c7b4; }
html.look-paper .bubble.system { color: var(--muted); }
html.look-paper .bubble.tutor .who,
html.look-paper .bubble.you .who {
  display: block;
  width: fit-content;
  opacity: 1;
  font-family: var(--brush);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: #fffaf0;
  background: var(--tutor);
  border-radius: 6px;
  padding: 0 0.6rem 0.1rem;
  margin: -1.35rem 0 0.35rem -0.3rem;
  transform: rotate(-2deg);
}
html.look-paper .bubble.tutor { margin-top: 0.7rem; }
html.look-paper .bubble.you { margin-top: 0.7rem; }
html.look-paper .bubble.you .who { background: var(--you); margin-left: auto; margin-right: -0.3rem; transform: rotate(2deg); }
html.look-paper .teach-figure { border-color: var(--border); background: #fffaf0; }

html.look-paper .inline-hear {
  background: #fffaf0;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
  font-family: var(--hand);
  font-size: 1.08em;
}
html.look-paper .phrase-hear,
html.look-paper .dialogue-hear {
  font-family: system-ui, -apple-system, sans-serif;
}
html.look-paper .inline-hear.is-playing {
  background: var(--gold, #e9b44c);
  color: var(--ink);
  border-color: var(--ink);
}
html.look-paper .gloss-tap { border-bottom-color: rgba(43, 34, 51, 0.35); }
html.look-paper .bubble em { color: #8a3a2c; }

html.look-paper .part { background: #fffaf0; border-color: var(--border); color: var(--ink); }
html.look-paper .part-phrase { background: #fff6dc; border-color: #e3c98a; border-left-color: var(--gold); }
html.look-paper .phrase-es { font-family: var(--hand); font-size: 2rem; font-weight: 400; color: var(--ink); }
html.look-paper .phrase-en { color: var(--muted); opacity: 1; }
html.look-paper .part-try { background: #fbe9e2; border-color: #e7b9ac; border-left: 4px solid var(--accent); }
html.look-paper .part-try .part-label { color: var(--accent); }
html.look-paper .part-try[data-try-kind="meaning"] {
  background: #dff0ee;
  border-color: #8cc0ba;
  border-left: 4px solid #1d6b66;
}
html.look-paper .part-try[data-try-kind="meaning"] .part-label { color: #175652; }
html.look-paper .try-lang-badge {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
html.look-paper .try-lang-en { background: #1d6b66; color: #fffaf0; border: 1px solid #144e4a; }
html.look-paper .try-lang-es { background: var(--accent); color: #fffaf0; border: 1px solid var(--accent-hover); }
html.look-paper .bubble.listen-mode-meaning .inline-hear-hidden {
  background: #eff9f8;
  border-color: #1d6b66;
  box-shadow: 0 2px 0 #1d6b66;
  color: #144e4a;
}
html.look-paper .bubble.listen-mode-reply-es .inline-hear-hidden {
  background: #fff3ee;
  border-color: var(--accent);
  box-shadow: 0 2px 0 var(--accent);
  color: var(--ink);
}
html.look-paper .composer textarea[data-task-cue="meaning"]:focus {
  border-color: #1d6b66;
  box-shadow: 0 0 0 3px rgba(29, 107, 102, 0.3);
}
html.look-paper .part-flow.part-continue { background: transparent; border: 0; }
html.look-paper .part-label { font-family: var(--brush); font-size: 0.95rem; font-weight: 400; letter-spacing: 0; text-transform: none; opacity: 1; }
html.look-paper .try-saying-btn,
html.look-paper .choice-btn {
  background: #fffaf0;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
}
html.look-paper .choice-btn:hover,
html.look-paper .try-saying-btn:hover { background: #fff2cf; }
html.look-paper .scene-line, html.look-paper .carlos-line { background: #f1e6cd; color: var(--ink); }

/* ------------------------------------------------------ message box */
html.look-paper .composer-tools,
html.look-paper .composer { background: var(--bg-chat); border-color: var(--border); }
html.look-paper .accent-bar button {
  background: var(--bg-elev);
  color: var(--ink);
  border: 1.5px solid var(--border);
  box-shadow: 0 2px 0 var(--border);
}
html.look-paper .composer textarea {
  background: #fffaf0;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
}
html.look-paper .composer textarea::placeholder { color: #6d5f53; }
html.look-paper .composer textarea:focus { box-shadow: 0 0 0 3px rgba(233, 180, 76, 0.55); outline: none; }

/* ----------------------------------------------------------- pop-ups */
/* Behind a pop-up the page dims with ink, as the game does; the generated
 * base would turn a dark veil into a pale haze. */
html.look-paper .flyout-backdrop,
html.look-paper .sheet-overlay,
html.look-paper .cycle-overlay,
html.look-paper .gate-overlay,
html.look-paper .sound-compare-overlay,
html.look-paper .lang-pick-overlay { background: rgba(43, 34, 51, 0.34); backdrop-filter: none; }
html.look-paper .cycle-overlay.is-intro-nonblocking { background: transparent; backdrop-filter: none; }

/* Titles of cards and pop-ups in the brush lettering. */
html.look-paper .cycle-card h2,
html.look-paper .sheet h2,
html.look-paper .sheet-head h2,
html.look-paper .gate-card h2,
html.look-paper .card-head h2,
html.look-paper .card-head h3,
html.look-paper .lang-pick-card h2 {
  font-family: var(--brush);
  font-weight: 400;
  font-size: 1.7rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
html.look-paper .cycle-card,
html.look-paper .sheet,
html.look-paper .gate-card,
html.look-paper .flyout,
html.look-paper .more-menu {
  border: 1.5px solid var(--border);
  border-radius: 10px 14px 11px 15px / 14px 10px 15px 11px;
  box-shadow: 0 3px 0 rgba(43, 34, 51, 0.12), 0 16px 36px rgba(43, 34, 51, 0.28);
}
html.look-paper .cycle-kicker { font-family: var(--brush); font-size: 1rem; letter-spacing: 0; text-transform: none; color: var(--accent); }

/* ------------------------------------------- banners over the lesson */
/* Placement, focused practice and form switches: a paper tag, like the
 * chapter line, so every banner over the conversation reads the same. */
html.look-paper .detour-bar,
html.look-paper .form-stage-bar,
html.look-paper .grad-chip { border-bottom: 1.5px solid var(--border); }
html.look-paper .detour-label,
html.look-paper .form-stage-label { font-family: var(--brush); font-size: 1.2rem; color: var(--ink); }

/* The landscape drifts very slowly, as the land does on a ride in the game:
 * a little wider than the bar, sliding end to end and back. */
@keyframes strip-drift { to { background-position: 100% 22%; } }
@media (prefers-reduced-motion: reduce) {
  html.look-paper .chat-panel::before { animation: none; background-position: 50% 22%; }
}

/* ------------------------------------ exercises, checks, the one next step */
html.look-paper .game-kind { color: #235c58; }
html.look-paper .game-card.grad-live .game-title { font-family: var(--brush); font-size: 1.35rem; font-weight: 400; }
/* The single way forward on a card is the game's gold button. */
html.look-paper .cycle-card .btn,
html.look-paper .btn.grad-continue,
html.look-paper .game-submit,
html.look-paper .ear-check-submit {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 2px 0 var(--ink);
  font-weight: 600;
}
html.look-paper .cycle-card .btn:hover,
html.look-paper .btn.grad-continue:hover { background: #f3c661; }

/* Forms & phrases: the phrases in the hand lettering, like the phrase card. */
html.look-paper .morph-table td.form { font-family: var(--hand); font-size: 1.12rem; font-weight: 400; }
html.look-paper .morph-table td.gloss { color: var(--muted); }
html.look-paper .morph-block h3 { font-family: var(--brush); font-weight: 400; font-size: 1.25rem; color: var(--accent); }
