:root {
  --paper: #FFFBF1;
  --paper-2: #FFF3DA;
  --line: #E8CFA6;
  --line-d: #C9A777;
  --ink: #4E3B2E;
  --ink-soft: #85705E;
  --accent: #EE9B4F;
  --accent-d: #C9762F;
  --ruby: #D9384E;
  --ruby-d: #A82338;
  --leaf: #7DB86A;
  --sea: #4FB9B3;
  --pink: #F4A7C0;
  --gold: #FFD447;
  --common: #8DBF6E;
  --uncommon: #5FAEDB;
  --rare: #A77BDB;
  --legendary: #F09A3E;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  display: flex; align-items: center; justify-content: center;
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 50% 35%, #46594C, #1B2420 70%);
}
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

#game {
  position: relative; overflow: hidden;
  border-radius: 0.7em;
  box-shadow: 0 1.5em 4em rgba(0, 0, 0, .5);
  user-select: none; -webkit-user-select: none;
  touch-action: none; -webkit-tap-highlight-color: transparent;
}
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

h1, h2, h3, .btn, .eyebrow, .logo, .pill b, .level-card b, .dlg-name, .ribbon, .titlecard b { font-family: "Baloo 2", "Nunito", sans-serif; }

/* ---------- buttons ---------- */
.btn {
  padding: .42em 1.3em; border: none; border-radius: 1.2em; cursor: pointer;
  font-weight: 800; font-size: 1em; color: #fff;
  background: var(--accent); box-shadow: 0 .22em 0 var(--accent-d);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-.06em); }
.btn:active { transform: translateY(.18em); box-shadow: 0 .04em 0 var(--accent-d); }
.btn:disabled { filter: grayscale(.8) opacity(.6); cursor: not-allowed; transform: none; }
.btn.ghost { background: var(--paper-2); color: var(--ink); box-shadow: 0 .22em 0 var(--line-d); }
.btn.small { font-size: .82em; padding: .3em .9em; }
.btn.ruby { background: var(--ruby); box-shadow: 0 .22em 0 var(--ruby-d); }
.xbtn {
  width: 1.9em; height: 1.9em; border-radius: 50%; cursor: pointer;
  border: .12em solid var(--line); background: var(--paper-2); font-weight: 800;
}

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
.hud-tl { position: absolute; top: .7em; left: .8em; display: grid; gap: .45em; justify-items: start; }
.hud-tr { position: absolute; top: .7em; right: .8em; display: grid; gap: .4em; justify-items: end; }
.hud-row { display: flex; gap: .4em; align-items: center; }
.level-card, .pill, .quest, .gear-chip, .hbtn {
  background: rgba(255, 251, 241, .93); border: .14em solid var(--line);
  border-radius: 1em; box-shadow: 0 .18em 0 rgba(110, 80, 50, .18);
}
.level-card { display: flex; gap: .5em; align-items: center; padding: .18em .8em .18em .25em; }
.level-card span { background: var(--accent); color: #fff; font-weight: 800; font-size: .78em; border-radius: .7em; padding: .05em .55em; }
.level-card b { font-size: 1.05em; }
.quest { pointer-events: auto; max-width: 17em; font-size: .86em; overflow: hidden; }
.quest-head { width: 100%; text-align: left; border: none; background: transparent; padding: .25em .7em; font-weight: 800; cursor: pointer; font-family: "Baloo 2", sans-serif; }
.quest-head i { font-style: normal; float: right; margin-left: .6em; }
.quest.collapsed ul { display: none; }
.quest.collapsed .quest-head i { transform: rotate(-90deg); display: inline-block; }
#questList { list-style: none; padding: 0 .7em .45em; display: grid; gap: .15em; }
#questList li { display: flex; gap: .4em; line-height: 1.25; }
#questList li::before { content: "○"; color: var(--line-d); flex: 0 0 auto; }
#questList li.done { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
#questList li.done::before { content: "✔"; color: var(--leaf); }
#questList li.flash { animation: qflash 1.2s; }
#questList li.hint { display: block; font-size: .9em; color: var(--ink-soft); background: rgba(255,224,138,.35); border-radius: .5em; padding: .25em .45em; margin-top: .15em; }
#questList li.hint::before { content: none; }
@keyframes qflash { 0%, 100% { background: transparent; } 30% { background: #FFF0B3; } }

.pill { display: flex; align-items: center; gap: .35em; padding: .15em .7em; font-weight: 800; }
.pill b { font-size: 1.1em; }
.coin { width: 1.05em; height: 1.05em; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #FFF2A8, #F5C431 55%, #D49A16); box-shadow: inset 0 0 0 .1em #C88F14; }
.coins.bump { animation: bump .35s; }
@keyframes bump { 50% { transform: scale(1.18); } }
.hbtn { pointer-events: auto; width: 2.1em; height: 2.1em; display: grid; place-items: center; font-size: 1em; cursor: pointer; border-radius: 50%; }
.hbtn:hover { background: #fff; }
.hp { gap: .45em; }
.hp span { color: var(--ruby); font-size: .85em; }
.hpbar { width: 7.5em; height: .7em; border-radius: 1em; background: #EAD7BF; overflow: hidden; }
.hpbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #F06A7B, #D9384E); transition: width .3s; }
.hp.hit { animation: shake .4s; }
@keyframes shake { 20% { transform: translateX(-.25em); } 40% { transform: translateX(.25em); } 60% { transform: translateX(-.15em); } 80% { transform: translateX(.15em); } }
.companions { display: flex; gap: .3em; }
.companions .comp {
  position: relative; width: 2.3em; height: 2.3em; border-radius: 50%;
  background: rgba(255, 251, 241, .93); border: .14em solid var(--line); overflow: hidden;
}
.companions .comp img { width: 100%; height: 100%; }
.companions .comp i { position: absolute; left: 0; bottom: 0; height: .25em; background: var(--gold); }
.gear-chip {
  position: absolute; left: .8em; bottom: .7em; pointer-events: auto; cursor: pointer;
  display: flex; align-items: center; gap: .3em; padding: .15em .7em .15em .3em; font-weight: 700; font-size: .85em;
}
.gear-chip img { width: 1.7em; height: 1.7em; }
.gear-chip em { color: var(--line-d); font-style: normal; }

.prompt {
  position: absolute; left: 50%; bottom: 1em; transform: translateX(-50%);
  padding: .3em 1.1em; border-radius: 2em; white-space: nowrap; pointer-events: none;
  background: rgba(78, 59, 46, .88); color: #FFF7E6; font-weight: 700;
}
.prompt kbd {
  display: inline-block; min-width: 1.4em; padding: 0 .35em; margin: 0 .15em;
  text-align: center; font: inherit; font-size: .85em; color: var(--ink);
  background: #fff; border-radius: .35em; border-bottom: .15em solid var(--line-d);
}

#toasts { position: absolute; right: .8em; top: 7.3em; display: grid; gap: .4em; justify-items: end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: .5em; align-items: center;
  max-width: 21em; padding: .35em .8em; border-radius: 1em;
  background: var(--paper); border: .14em solid var(--line); font-weight: 700; font-size: .9em;
  box-shadow: 0 .2em 0 rgba(110, 80, 50, .18);
  animation: toastIn .35s cubic-bezier(.2, 1.4, .4, 1);
}
.toast img { width: 1.9em; height: 1.9em; }
.toast button { border: none; background: var(--paper-2); border-radius: .7em; padding: .05em .55em; cursor: pointer; font-weight: 800; font-size: .85em; }
.toast.nai { background: #FFF6C9; border-color: #F0D36C; }
.toast.bad { background: #FFE9E6; border-color: #F2B2A8; }
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastIn { from { transform: translateX(1em); opacity: 0; } }
@keyframes toastOut { to { transform: translateX(1em); opacity: 0; } }

/* ---------- fishing UIs ---------- */
.reel {
  position: absolute; right: 4%; top: 50%; transform: translateY(-50%);
  width: 9.2em; padding: .55em .65em .6em; text-align: center;
  background: rgba(255, 251, 241, .95); border: .2em solid var(--line); border-radius: 1.2em;
  box-shadow: 0 .35em 0 rgba(110, 80, 50, .18);
}
.reel-title { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 1.2em; line-height: 1; color: var(--accent-d); }
.reel-diff { color: #E2A03A; font-size: .78em; letter-spacing: .1em; }
.reel-body { display: flex; gap: .45em; justify-content: center; margin: .35em 0; }
.track { position: relative; width: 3.1em; height: 13.5em; overflow: hidden; border-radius: 1.6em; border: .16em solid #6E9AA6; background: linear-gradient(#A6DFE3, #3F86A0); }
.zone { position: absolute; left: .18em; right: .18em; border-radius: 1em; background: rgba(170, 235, 150, .45); border: .14em solid rgba(110, 180, 90, .95); transition: background .12s, box-shadow .12s; }
.zone.hit { background: rgba(205, 255, 170, .85); box-shadow: 0 0 .8em rgba(255, 255, 200, .9); }
.reel-fish { position: absolute; left: 50%; width: 2.3em; height: 1.3em; transform: translate(-50%, 50%); background-size: contain; background-repeat: no-repeat; background-position: center; }
.progress { position: relative; width: .85em; height: 13.5em; overflow: hidden; border-radius: 1em; background: #EADBC3; }
.progress .fill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(#FFD447, #EE9B4F); }
.reel-hint { font-size: .7em; color: var(--ink-soft); line-height: 1.2; }

.tension {
  position: absolute; left: 50%; bottom: 3.4em; transform: translateX(-50%); width: 26em;
  padding: .55em .9em .65em; text-align: center;
  background: rgba(255, 251, 241, .95); border: .2em solid #F0C27A; border-radius: 1.2em;
  box-shadow: 0 0 1.5em rgba(255, 200, 120, .5);
}
.tension-title { font-family: "Baloo 2", sans-serif; font-weight: 800; color: var(--ruby); letter-spacing: .05em; }
.tension-bar { position: relative; height: 1.1em; margin: .35em 0 .1em; border-radius: 1em; background: linear-gradient(90deg, #BFD7E2, #E9E2C9 45%, #F7B9A8 80%, #E2475B); overflow: hidden; }
.tension-safe { position: absolute; left: 35%; width: 40%; top: 0; bottom: 0; background: rgba(140, 220, 120, .55); border-left: .12em solid #6FB35B; border-right: .12em solid #6FB35B; }
.tension-needle { position: absolute; top: -.1em; bottom: -.1em; width: .35em; margin-left: -.175em; background: var(--ink); border-radius: .2em; box-shadow: 0 0 .3em #fff; }
.tension-labels { display: flex; justify-content: space-between; font-size: .7em; color: var(--ink-soft); padding: 0 .3em; }
.tension-prog { height: .55em; margin-top: .35em; border-radius: 1em; background: #EADBC3; overflow: hidden; }
.tension-prog div { height: 100%; width: 0; background: linear-gradient(90deg, #FFD447, #D9384E); }
.tension-msg { margin-top: .3em; font-size: .8em; font-weight: 700; }
.tension-msg.warn { color: var(--ruby); animation: bump .4s infinite; }

/* ---------- dialogue ---------- */
.dialog {
  position: absolute; left: 50%; bottom: .8em; transform: translateX(-50%);
  width: 41em; min-height: 6.6em; display: flex; gap: .7em; align-items: stretch;
  padding: .55em .9em .55em .55em; cursor: pointer;
  background: var(--paper); border: .22em solid var(--line); border-radius: 1.3em;
  box-shadow: 0 .35em 0 rgba(110, 80, 50, .2), 0 .8em 2em rgba(0, 0, 0, .2);
  animation: pop .3s cubic-bezier(.2, 1.4, .4, 1);
}
#portrait { width: 5.6em; height: 5.6em; flex: 0 0 auto; border-radius: 1em; background: linear-gradient(#FFF3DA, #F6E2BE); }
.dlg-body { position: relative; flex: 1; }
.dlg-name { font-weight: 800; color: var(--accent-d); font-size: 1.05em; line-height: 1.1; }
#dlgText { font-size: 1.02em; line-height: 1.38; min-height: 2.8em; }
.dlg-next { position: absolute; right: 0; bottom: 0; color: var(--accent); animation: bob 1s infinite; }
.dialog.choosing .dlg-next { display: none; }
.dlg-choices { display: flex; gap: .4em; flex-wrap: wrap; margin-top: .3em; }
@keyframes bob { 50% { transform: translateY(.2em); } }

/* ---------- overlays & cards ---------- */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(50, 36, 26, .38); backdrop-filter: blur(2px); }
.overlay.soft { background: rgba(50, 36, 26, .2); }
.card, .panel-card {
  background: var(--paper); border: .24em solid var(--line); border-radius: 1.4em;
  box-shadow: 0 .45em 0 rgba(110, 80, 50, .2), 0 1em 3em rgba(0, 0, 0, .28);
  animation: pop .4s cubic-bezier(.2, 1.4, .4, 1);
}
.card { padding: 1em 1.4em; text-align: center; max-height: 95%; overflow: auto; }
.muted { color: var(--ink-soft); }
.small { font-size: .85em; }
.error { color: var(--ruby); font-weight: 700; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72em; font-weight: 800; color: var(--accent-d); }
@keyframes pop { from { transform: scale(.88); opacity: 0; } }

.panel-card { width: 44em; height: 86%; display: flex; flex-direction: column; overflow: hidden; }
.panel-card header { display: flex; align-items: center; justify-content: space-between; padding: .6em 1em .2em; }
.panel-card h2 { font-size: 1.45em; }
.tabs { display: flex; gap: .3em; padding: 0 1em; border-bottom: .14em solid var(--line); }
.tabs button { border: none; background: transparent; padding: .3em .8em; font-weight: 800; cursor: pointer; border-radius: .8em .8em 0 0; color: var(--ink-soft); }
.tabs button.on { background: var(--paper-2); color: var(--ink); box-shadow: inset 0 -.18em 0 var(--accent); }
.panel-body { flex: 1; overflow: auto; padding: .7em 1em; }
.panel-foot { padding: .5em 1em .7em; border-top: .14em solid var(--line); display: flex; align-items: center; gap: .8em; justify-content: space-between; }
.panel-foot:empty { display: none; }

.rows { display: grid; gap: .4em; }
.row {
  display: flex; gap: .7em; align-items: center; padding: .4em .6em;
  background: #fff; border: .12em solid #F0E1C8; border-radius: .9em;
}
.row.locked { opacity: .55; }
.row img, .row canvas { width: 3em; height: 3em; flex: 0 0 auto; }
.row .info { flex: 1; min-width: 0; }
.row .info b { display: block; font-family: "Baloo 2", sans-serif; font-size: 1.05em; line-height: 1.1; }
.row .info p { font-size: .82em; color: var(--ink-soft); line-height: 1.25; }
.row .price { font-weight: 800; white-space: nowrap; display: flex; align-items: center; gap: .25em; }
.row .tag { font-size: .7em; font-weight: 800; padding: .05em .5em; border-radius: .6em; color: #fff; margin-left: .3em; vertical-align: middle; }
.row .act { display: flex; gap: .3em; align-items: center; }
.qty { display: flex; align-items: center; gap: .2em; }
.qty button { width: 1.6em; height: 1.6em; border-radius: 50%; border: .12em solid var(--line); background: var(--paper-2); font-weight: 800; cursor: pointer; }
.qty span { min-width: 1.8em; text-align: center; font-weight: 800; }
.empty { text-align: center; color: var(--ink-soft); padding: 2em 1em; }
.section-title { font-family: "Baloo 2", sans-serif; font-weight: 800; color: var(--accent-d); margin: .5em 0 .2em; }

.journal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.3em, 1fr)); gap: .5em; }
.jcard { background: #fff; border: .14em solid #F0E1C8; border-radius: 1em; padding: .4em .5em .5em; text-align: center; }
.jcard canvas { width: 100%; height: auto; }
.jcard b { display: block; font-family: "Baloo 2", sans-serif; line-height: 1.1; }
.jcard small { display: block; color: var(--ink-soft); font-size: .75em; }
.jcard.unknown b { color: #B8A58C; }
.rar { display: inline-block; font-size: .7em; font-weight: 800; color: #fff; padding: 0 .5em; border-radius: .6em; }

.settings { display: grid; gap: .6em; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 1em; padding: .45em .7em; background: #fff; border: .12em solid #F0E1C8; border-radius: .9em; }
.set-row small { display: block; color: var(--ink-soft); font-weight: 600; }
.set-row input[type=range] { width: 10em; accent-color: var(--accent); }
.switch { position: relative; width: 2.8em; height: 1.5em; border-radius: 1em; border: none; background: #D9C9B0; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: .18em; left: .2em; width: 1.15em; height: 1.15em; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch.on { background: var(--leaf); }
.switch.on::after { transform: translateX(1.25em); }
.seg { display: flex; border-radius: .9em; overflow: hidden; border: .12em solid var(--line); }
.seg button { border: none; padding: .2em .6em; background: #fff; cursor: pointer; font-weight: 700; font-size: .85em; }
.seg button.on { background: var(--accent); color: #fff; }

.catch-card { width: 23em; position: relative; padding-top: 1.7em; }
.catch-card canvas { width: 100%; height: auto; }
.ribbon { position: absolute; top: -.1em; left: 50%; transform: translateX(-50%); padding: .1em 1.3em; border-radius: 0 0 .8em .8em; color: #fff; font-weight: 800; background: var(--common); }
.new-badge { position: absolute; top: .6em; right: .8em; background: var(--ruby); color: #fff; font-weight: 800; font-size: .75em; padding: .05em .5em; border-radius: .6em; transform: rotate(8deg); }
.sweet { font-weight: 700; color: #C55E7C; margin: .2em 0 .3em; }

.achievement {
  position: absolute; top: 4.5em; left: 50%; transform: translateX(-50%);
  display: flex; gap: .7em; align-items: center; padding: .55em 1.1em .55em .6em;
  background: linear-gradient(135deg, #FFF6D0, #FFE3EC); border: .2em solid #F2C35E; border-radius: 1.2em;
  box-shadow: 0 0 1.4em rgba(255, 210, 90, .7); animation: achIn .6s cubic-bezier(.2, 1.5, .4, 1);
}
.ach-icon { font-size: 2.2em; animation: spin 1.4s ease-out; }
.achievement small { color: var(--accent-d); font-weight: 800; text-transform: uppercase; letter-spacing: .1em; font-size: .7em; }
.achievement b { display: block; font-family: "Baloo 2", sans-serif; font-size: 1.25em; line-height: 1; }
.achievement p { font-size: .85em; }
@keyframes achIn { from { transform: translate(-50%, -2em) scale(.6); opacity: 0; } }
@keyframes spin { from { transform: rotate(-360deg) scale(.3); } }

.titlecard {
  position: absolute; left: 50%; top: 30%; transform: translateX(-50%); text-align: center;
  color: #fff; text-shadow: 0 .1em .4em rgba(0, 0, 0, .45); animation: tcIn 3.4s forwards; pointer-events: none;
}
.titlecard small { display: block; font-weight: 800; letter-spacing: .3em; text-transform: uppercase; }
.titlecard b { display: block; font-size: 3em; line-height: 1; }
@keyframes tcIn { 0% { opacity: 0; transform: translate(-50%, .6em); } 15%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

.letterbox { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.letterbox i { position: absolute; left: 0; right: 0; height: 0; background: #120D0A; transition: height .6s ease; pointer-events: none; }
.dialog, .overlay, .achievement, .tension, .reel, #toasts, .ending-ui, .titlecard { z-index: 2; }
.fade { z-index: 3; }
/* settings / credits / shop panels open on top of the main menu; confirm dialogs above those */
#panel { z-index: 4; }
#confirm { z-index: 5; }
.cine .dialog { bottom: 3.1em; }
.cine #hud, .cine .prompt { opacity: 0; transition: opacity .4s; }
#hud { transition: opacity .4s; }
.letterbox i:first-child { top: 0; }
.letterbox i:last-child { bottom: 0; }
.letterbox.on i { height: 2.6em; }
.fade { position: absolute; inset: 0; background: #FFFBEF; opacity: 0; pointer-events: none; transition: opacity .8s ease; }
.fade.on { opacity: 1; pointer-events: auto; }
.fade.dark { background: #120D0A; }

/* ---------- menu ---------- */
.menu { background: linear-gradient(180deg, rgba(30, 40, 35, .1), rgba(30, 24, 18, .45)); }
.menu-card { text-align: center; color: #fff; text-shadow: 0 .1em .5em rgba(0, 0, 0, .4); }
.logo { font-size: 3.2em; line-height: .95; max-width: 11em; margin: .15em auto .5em; }
.logo span { display: block; color: #FFD9DE; font-size: 1.3em; }
.menu .eyebrow { color: #FFE6A8; }
.menu-buttons { display: grid; gap: .5em; justify-items: center; }
.menu-buttons .btn { min-width: 12em; font-size: 1.1em; }
.menu-foot { margin-top: 1em; font-size: .8em; opacity: .85; }
.credits p { margin: .3em 0; }

/* ---------- wish ---------- */
.wish { background: radial-gradient(circle at 50% 45%, rgba(255, 240, 250, .25), rgba(20, 30, 50, .6)); }
.wish-card { width: 46em; display: flex; gap: 1em; align-items: center; text-align: left; background: linear-gradient(160deg, #FFFDF8, #FDEFF6 60%, #E9F7F6); border-color: #EBC6D6; }
#wishPortrait { width: 13em; height: 13em; flex: 0 0 auto; }
.wish-main { flex: 1; }
.wish-main h2 { font-size: 1.35em; line-height: 1.2; margin: .2em 0 .5em; }
#wishInput {
  width: 100%; resize: none; padding: .6em .8em; font: inherit; font-size: 1em; line-height: 1.4;
  border-radius: 1em; border: .16em solid #EBC6D6; background: #fff; color: var(--ink); outline: none;
  user-select: text; -webkit-user-select: text;
}
#wishInput:focus { border-color: var(--pink); box-shadow: 0 0 0 .2em rgba(244, 167, 192, .3); }
.wish-row { display: flex; justify-content: space-between; align-items: center; margin: .35em 0 .5em; }
.wish-row.gap { justify-content: flex-start; gap: .6em; flex-wrap: wrap; }
blockquote { white-space: pre-wrap; word-break: break-word; padding: .7em .9em; margin: .4em 0; background: #fff; border-left: .3em solid var(--pink); border-radius: .6em; max-height: 9em; overflow: auto; user-select: text; }
.pearl-spin { width: 3.5em; height: 3.5em; margin: .5em auto; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #F5E6F2 40%, #CDB8E8 75%); box-shadow: 0 0 1.5em rgba(220, 190, 255, .9); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.12); box-shadow: 0 0 2.5em rgba(255, 210, 240, 1); } }
.claim-code {
  font-family: "Baloo 2", monospace; font-weight: 800; font-size: 2.2em; letter-spacing: .08em;
  text-align: center; padding: .2em .5em; margin: .2em 0 .4em; border-radius: .6em;
  background: linear-gradient(135deg, #FFF3F6, #FFE6B8); border: .12em dashed var(--ruby); color: var(--ruby-d);
  user-select: all; -webkit-user-select: all; animation: codeIn 1s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes codeIn { from { transform: scale(.4) rotate(-6deg); opacity: 0; filter: blur(6px); } }
.claim-msg { margin: .5em 0; line-height: 1.4; }
.offline-box { background: #FFF6DE; border: .12em solid #F2D39A; border-radius: .9em; padding: .5em .7em; margin-bottom: .5em; }

/* ---------- ending ---------- */
.ending-ui { position: absolute; inset: 0; pointer-events: none; color: #fff; text-align: center; animation: endIn 2s ease; }
.end-text {
  position: absolute; left: 0; right: 0; top: 0; padding: 1.1em 15% 2.6em;
  background: linear-gradient(rgba(50, 25, 55, .62), rgba(50, 25, 55, .35) 65%, rgba(50, 25, 55, 0));
  text-shadow: 0 .1em .5em rgba(60, 20, 30, .6);
}
.ending-ui h1 { font-size: 2.7em; line-height: 1; color: #FFE3E8; }
.ending-ui p { font-size: .95em; line-height: 1.45; margin-top: .45em; white-space: pre-line; }
.end-buttons { position: absolute; left: 0; right: 0; bottom: 1em; display: flex; gap: .5em; justify-content: center; flex-wrap: wrap; pointer-events: auto; }
@keyframes endIn { from { opacity: 0; } }

.confirm-card { width: 24em; }
.confirm-card h3 { font-size: 1.3em; }
.confirm-card p { margin: .4em 0 .6em; }
.confirm-card .wish-row { justify-content: center; }

/* ---------- touch ---------- */
.touch { position: absolute; inset: 0; pointer-events: none; }
.joy { position: absolute; left: 1.2em; bottom: 1.2em; width: 7.5em; height: 7.5em; border-radius: 50%; background: rgba(255, 251, 241, .35); border: .16em solid rgba(255, 251, 241, .7); pointer-events: auto; touch-action: none; }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 3.2em; height: 3.2em; margin: -1.6em 0 0 -1.6em; border-radius: 50%; background: rgba(255, 251, 241, .9); box-shadow: 0 .2em .4em rgba(0, 0, 0, .2); }
.t-action { position: absolute; right: 1.4em; bottom: 1.6em; width: 5.2em; height: 5.2em; border-radius: 50%; pointer-events: auto; touch-action: none; border: .2em solid #fff; background: rgba(238, 155, 79, .9); color: #fff; font-size: 1.3em; font-weight: 800; box-shadow: 0 .25em 0 var(--accent-d); }
.t-action:active, .t-action.on { transform: translateY(.15em); box-shadow: none; }
body.touch-mode .gear-chip { left: 50%; transform: translateX(-50%); bottom: .6em; }
body.touch-mode .prompt { bottom: 6.2em; }

.rotate { display: none; position: fixed; inset: 0; z-index: 9; align-items: center; justify-content: center; text-align: center; background: #22302A; color: #FFF3DA; font: 800 1.3em "Baloo 2", sans-serif; }
@media (orientation: portrait) and (max-width: 820px) and (pointer: coarse) { .rotate { display: flex; } }

/* larger text accessibility */
body.big-text .dialog, body.big-text .prompt, body.big-text .quest, body.big-text .toast { font-size: 1.14em; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation-duration: .01s !important; transition-duration: .01s !important; }
