:root {
  --ink: #3A2E2A;
  --text: #2B2523;
  --mut: #6B5E57;
  --line: rgba(58, 46, 42, .18);
  --row: rgba(58, 46, 42, .05);
  --paper: rgba(255, 249, 238, .96);
  --paper-solid: #FFF9EE;
  --paper-2: #F6EEDC;
  --accent: #F27B35;
  --accent-dk: #CF5F1E;
  --on-accent: #FFFFFF;
  --sky: #9ED3EE;
  --sky-dk: #4E9BCB;
  --teal: #8ED3CB;
  --pink: #F4A6B8;
  --sun: #F2C14E;
  --leaf: #7CC27A;
  --good: #2E6A3C;
  --bad: #B42318;
  --rh: #00C805;
  --shadow: 0 3px 0 rgba(58, 46, 42, .18), 0 10px 26px rgba(30, 50, 70, .16);
  --shadow-sm: 0 2px 0 rgba(58, 46, 42, .2);
  --shadow-card: 0 4px 0 rgba(58, 46, 42, .16), 0 18px 44px rgba(20, 40, 60, .26);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.52 0 0 0 0 0.42 0 0 0 0 0.3 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
  --display: "Fredoka", "Patrick Hand", ui-rounded, system-ui, sans-serif;
  --font: "Patrick Hand", "Kalam", ui-rounded, system-ui, sans-serif;
  --voice: "Kalam", "Patrick Hand", ui-rounded, system-ui, sans-serif;
  --gut: 16px;
  --sa-t: env(safe-area-inset-top, 0px);
  --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px);
  --sa-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: #CFE9F2;
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
input { font: inherit; color: var(--text); user-select: text; }
:focus-visible { outline: 3px solid var(--sky-dk); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { display: block; flex: none; }
[hidden] { display: none !important; }

/* ---------- 3D canvas ---------- */
#gl {
  position: fixed; inset: 0; width: calc(100 * var(--vw)); height: calc(100 * var(--vh)); height: calc(100 * var(--vh)); display: block;
  transition: filter 1.1s ease, transform 1.4s cubic-bezier(.2, .8, .2, 1);
}
body.landing #gl { filter: blur(6px) saturate(1.1) brightness(1.03); transform: scale(1.06); }
#labels { position: fixed; inset: 0; pointer-events: none; }
body.landing #labels { opacity: 0; }

/* ---------- landing ---------- */
#landing {
  position: fixed; inset: 0;
  display: grid; grid-template-rows: 1fr auto auto; justify-items: center;
  padding: calc(var(--sa-t) + 24px) var(--gut) calc(var(--sa-b) + 14px);
  text-align: center;
  background:
    radial-gradient(120% 70% at 50% 40%, rgba(255, 249, 238, 0) 40%, rgba(255, 249, 238, .35) 100%),
    linear-gradient(180deg, rgba(158, 211, 238, .25), rgba(255, 249, 238, 0) 40%, rgba(255, 249, 238, .2));
  transition: opacity .7s ease, transform .9s ease, visibility 0s linear .9s;
  z-index: 5;
}
body:not(.landing) #landing { opacity: 0; transform: scale(1.05); visibility: hidden; pointer-events: none; }
body.landing.joining #landing { opacity: .6; pointer-events: none; }

.clouds { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.cloud { position: absolute; width: 220px; fill: #FFFFFF; stroke: none; filter: drop-shadow(0 10px 18px rgba(30, 60, 90, .12)); animation: drift linear infinite; }
.cloud path:first-child { fill: #FFFFFF; }
.cloud .sh { fill: #E5F2F9; }
.c1 { top: 8%; width: 260px; animation-duration: 120s; animation-delay: -30s; }
.c2 { top: 22%; width: 170px; animation-duration: 95s; animation-delay: -70s; opacity: .95; }
.c3 { top: 46%; width: 210px; animation-duration: 150s; animation-delay: -10s; opacity: .7; }
.c4 { top: 4%; width: 140px; animation-duration: 80s; animation-delay: -55s; }
@keyframes drift { from { transform: translateX(-35vw); } to { transform: translateX(calc(135 * var(--vw))); } }

.hero { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
.mascot { display: block; width: 96px; height: 96px; border-radius: 50%; object-fit: contain; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 8px 14px rgba(20, 50, 80, .22)); animation: bob 4.5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg); } }
.logo { width: min(560px, calc(90 * var(--vw))); height: auto; margin-top: 2px; overflow: visible; filter: drop-shadow(0 12px 22px rgba(20, 50, 80, .2)); }
.logo .word text { font-family: var(--display); font-weight: 700; font-size: 168px; letter-spacing: -2px; stroke-linejoin: round; paint-order: stroke; }
.logo .l-ink { fill: var(--ink); stroke: var(--ink); stroke-width: 34px; }
.logo .l-cream { fill: var(--paper-solid); stroke: var(--paper-solid); stroke-width: 20px; }
.logo .l-fill { fill: url(#lgfill); stroke: var(--ink); stroke-width: 4px; }
.logo .l-shine { fill: url(#lgshine); }
.logo .wave { fill: none; stroke: var(--ink); stroke-width: 15px; stroke-linecap: round; }
.logo .wave2 { fill: none; stroke: var(--sky); stroke-width: 8px; stroke-linecap: round; }
.logo .ribbon rect { fill: var(--teal); stroke: var(--ink); stroke-width: 4px; }
.logo .ribbon text { font-family: var(--display); font-weight: 600; font-size: 30px; letter-spacing: 8px; fill: var(--ink); }
.logo .spark path { fill: var(--sun); stroke: var(--ink); stroke-width: 3px; stroke-linejoin: round; }
.logo .spark { animation: twinkle 3s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes twinkle { 50% { opacity: .55; transform: scale(.85); } }
.tagline {
  margin: 4px 0 0; font-family: var(--voice); font-size: clamp(18px, calc(2.3 * var(--vw)), 24px); color: var(--ink); text-wrap: balance;
  text-shadow: 0 0 10px rgba(255, 249, 238, .9), 0 0 2px rgba(255, 249, 238, 1);
}

.cta { display: grid; gap: 12px; justify-items: center; margin-bottom: 18px; }
.cta-row { display: flex; align-items: center; gap: 14px; }
.cta-row.small { gap: 10px; }
.btn-play {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 10px 48px 10px 12px; min-height: 66px; border-radius: 999px;
  font-family: var(--display); font-weight: 600; font-size: 30px; color: var(--on-accent);
  background: var(--accent); border: 2px solid var(--ink);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .12), inset 0 3px 0 rgba(255, 255, 255, .25), 0 4px 0 rgba(58, 46, 42, .25), 0 14px 30px rgba(207, 95, 30, .35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-play .pc { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-solid); color: var(--accent); border: 2px solid var(--ink); }
.btn-play .pc .ic { margin-left: 3px; }
.btn-play:hover { transform: translateY(-2px); }
.btn-play:active { transform: translateY(2px); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12), 0 1px 0 rgba(58, 46, 42, .25), 0 6px 14px rgba(207, 95, 30, .3); }

.rb {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; padding: 0;
  background: var(--paper); border: 1.5px solid var(--ink); color: var(--ink); box-shadow: var(--shadow-sm);
  transition: transform .12s ease, background .12s ease;
}
.rb.big { width: 56px; height: 56px; }
.rb:hover { transform: translateY(-1px); background: var(--paper-solid); }
.rb:active { transform: translateY(1px); box-shadow: none; }
.rb.connected { background: var(--teal); }
.rb.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(242, 123, 53, .25), var(--shadow-sm); } }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  font-family: var(--display); font-weight: 500; font-size: 14px;
  background: rgba(255, 249, 238, .88); border: 1.5px solid var(--ink); box-shadow: var(--shadow-sm);
}
.pill.accent { background: var(--accent); color: var(--on-accent); }
.pill.dim { opacity: .7; }
.pill:active { transform: translateY(1px); box-shadow: none; }
.gate-note {
  margin: 0; font-size: 15px; color: var(--ink); padding: 3px 12px; border-radius: 999px;
  background: rgba(255, 249, 238, .62); backdrop-filter: blur(4px);
}
.foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px;
  font-family: var(--display); font-weight: 500; font-size: 13px; color: var(--ink);
  padding: 6px 14px; border-radius: 999px; background: rgba(255, 249, 238, .72); backdrop-filter: blur(6px);
  max-width: 100%;
}
.foot .stat { display: inline-flex; align-items: center; gap: 4px; }
.foot .sep { opacity: .45; }
.chain { display: inline-flex; align-items: center; gap: 6px; }
.rh-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rh); box-shadow: 0 0 0 2px rgba(0, 200, 5, .2); }
.xlink { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--paper-solid); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 6; opacity: 0; visibility: hidden; transition: opacity .6s ease .3s, visibility 0s linear .9s; }
body.playing #hud { opacity: 1; visibility: visible; transition: opacity .6s ease .3s, visibility 0s; }
body:not(.playing) #hud * { pointer-events: none !important; }
#hud > * { pointer-events: auto; }
.tl { position: absolute; top: calc(var(--sa-t) + 14px); left: calc(var(--sa-l) + 14px); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.meters { display: flex; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px 5px 8px; min-height: 36px;
  border-radius: 999px; background: var(--paper); border: 1.5px solid var(--ink); box-shadow: var(--shadow-sm);
  font-size: 17px; line-height: 1;
}
.chip b { font-family: var(--display); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.chip.name { padding-left: 10px; font-family: var(--display); font-weight: 600; font-size: 15px; }
.chip.warn { background: #FFE9D6; }
.chip.quest { max-width: min(330px, calc(70 * var(--vw))); }
.chip.quest span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.quest b { margin-left: 4px; padding: 2px 7px; border-radius: 999px; background: var(--paper-2); font-size: 13px; }
.chip.quest.ready { background: #FFF1C9; animation: pulse 2s ease-in-out infinite; }
.chip:active, .rb:active { transform: translateY(1px); }

.tr { position: absolute; top: calc(var(--sa-t) + 14px); right: calc(var(--sa-r) + 14px); display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: calc(60 * var(--vw)); }
.bl { position: absolute; left: calc(var(--sa-l) + 14px); bottom: calc(var(--sa-b) + 14px); width: min(320px, calc(44 * var(--vw))); display: flex; flex-direction: column; gap: 6px; }
#chatlog { display: flex; flex-direction: column; gap: 3px; pointer-events: none; }
#chatlog .line { align-self: flex-start; max-width: 100%; padding: 3px 10px; border-radius: 12px; background: rgba(255, 249, 238, .82); font-size: 15px; line-height: 1.25; transition: opacity 1.2s; overflow-wrap: anywhere; }
#chatlog .line.old { opacity: 0; }
#chatlog b { font-family: var(--display); font-weight: 600; font-size: 13px; }
#chat input {
  width: 100%; height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--ink);
  background: var(--paper); box-shadow: var(--shadow-sm); outline: none; font-size: 16px;
}
#chat input::placeholder { color: var(--mut); }
.bc { position: absolute; left: 50%; bottom: calc(var(--sa-b) + 14px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
#prompt {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px 6px 6px; border-radius: 999px;
  background: var(--paper-solid); border: 1.5px solid var(--ink); box-shadow: var(--shadow);
  font-size: 18px; animation: pop .18s ease-out;
}
kbd {
  display: inline-grid; place-items: center; min-width: 28px; height: 26px; padding: 0 7px; border-radius: 9px;
  font-family: var(--display); font-weight: 600; font-size: 13px; background: var(--ink); color: var(--paper-solid);
}
.btn kbd { min-width: 20px; height: 18px; font-size: 11px; border-radius: 6px; margin-left: 2px; background: rgba(58, 46, 42, .8); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
#emotes { display: flex; gap: 6px; }
#emotes button {
  padding: 4px 11px; border-radius: 12px; border: 1.5px solid var(--ink); background: var(--paper-2);
  font-size: 15px; box-shadow: var(--shadow-sm);
}
#emotes button:active { transform: translateY(1px); box-shadow: none; }
#joy, #act { display: none; }
body.touch #joy {
  display: block; position: absolute; left: calc(var(--sa-l) + 22px); bottom: calc(var(--sa-b) + 112px);
  width: 124px; height: 124px; border-radius: 50%; background: rgba(255, 249, 238, .35); border: 1.5px solid rgba(58, 46, 42, .4); touch-action: none;
}
body.touch #joy i { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink); box-shadow: var(--shadow-sm); }
body.touch #act {
  display: grid; place-items: center; position: absolute; right: calc(var(--sa-r) + 24px); bottom: calc(var(--sa-b) + 110px);
  width: 78px; height: 78px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); font-family: var(--display); font-weight: 600; font-size: 18px; opacity: .55;
  box-shadow: var(--shadow);
}
body.touch #act.live { opacity: 1; background: var(--accent); color: #fff; }
body.touch .bl { bottom: calc(var(--sa-b) + 14px); width: min(260px, calc(52 * var(--vw))); }
body.touch #chatlog { display: none; }
body.touch .bc { bottom: calc(var(--sa-b) + 62px); left: 0; right: 0; transform: none; pointer-events: none; }
body.touch .bc > * { pointer-events: auto; }
body.touch #prompt { position: fixed; right: calc(var(--sa-r) + 14px); bottom: calc(var(--sa-b) + 200px); max-width: calc(64 * var(--vw)); font-size: 16px; }
body.touch #prompt kbd { display: none; }
body.touch #prompt { padding-left: 14px; }
body.panel-open #hud .bc, body.panel-open #joy, body.panel-open #act { opacity: 0; pointer-events: none; }
body.placing #emotes, body.placing #prompt { display: none; }
#placebar {
  position: absolute; left: 50%; bottom: calc(var(--sa-b) + 70px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 16px; border-radius: 999px;
  background: var(--paper-solid); border: 1.5px solid var(--ink); box-shadow: var(--shadow); white-space: nowrap;
}

/* ---------- world labels ---------- */
.nametag {
  padding: 1px 10px 2px; border-radius: 999px; background: rgba(255, 249, 238, .92); border: 1.5px solid var(--ink);
  font-family: var(--display); font-weight: 600; font-size: 12px; color: var(--ink); white-space: nowrap;
}
.nametag.me { background: var(--accent); color: #fff; }
.bubble {
  max-width: 220px; padding: 6px 12px; border-radius: 16px; background: var(--paper-solid); border: 1.5px solid var(--ink);
  font-family: var(--voice); font-size: 15px; line-height: 1.25; color: var(--text); box-shadow: var(--shadow-sm);
  overflow-wrap: anywhere; animation: pop .2s ease-out; position: relative;
}
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 12px; height: 12px; margin-left: -6px; background: var(--paper-solid); border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: rotate(45deg); }
.pop { font-family: var(--display); font-weight: 600; font-size: 18px; color: var(--ink); white-space: nowrap; text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 6px #fff; }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: calc(var(--sa-t) + 70px); left: 50%; transform: translateX(-50%); z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; width: min(460px, calc(calc(100 * var(--vw)) - 32px)); }
.toast {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 16px;
  background: var(--paper-solid); border: 1.5px solid var(--ink); box-shadow: var(--shadow);
  font-size: 17px; line-height: 1.25; text-align: center; animation: pop .2s ease-out; transition: opacity .4s, transform .4s;
}
.toast.good { background: #EAF7E4; }
.toast.bad { background: #FFE8E1; }
.toast.out { opacity: 0; transform: translateY(-6px); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--ink); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
#netstat {
  position: fixed; left: 50%; bottom: calc(var(--sa-b) + 14px); transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--paper-solid); border: 1.5px solid var(--ink); font-size: 15px;
}
body:not(.ready) #netstat { bottom: auto; top: calc(var(--sa-t) + 14px); }

/* ---------- panels ---------- */
#panel-wrap {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: var(--gut);
  background: rgba(30, 50, 70, .16); animation: fade .2s ease-out;
}
#panel-wrap.side { place-items: center end; background: linear-gradient(90deg, transparent 40%, rgba(30, 50, 70, .14)); }
@keyframes fade { from { opacity: 0; } }
.card {
  background: var(--paper-solid) var(--grain); border: 2px solid var(--ink); border-radius: 26px; box-shadow: var(--shadow-card);
}
.panel {
  width: min(560px, calc(calc(100 * var(--vw)) - 32px)); max-height: min(calc(80 * var(--vh)), 760px); max-height: min(calc(80 * var(--vh)), 760px);
  display: flex; flex-direction: column; overflow: hidden; animation: rise .25s cubic-bezier(.2, .9, .3, 1.2);
}
.side .panel { width: min(400px, calc(calc(100 * var(--vw)) - 32px)); max-height: calc(calc(100 * var(--vh)) - 32px); }
@keyframes rise { from { transform: translateY(14px) scale(.97); opacity: 0; } }
.panel header { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px 18px; border-bottom: 1.5px dashed var(--line); }
.ptitle { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 600; font-size: 22px; color: var(--ink); flex: 1; min-width: 0; }
.psub { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; padding: 3px 10px; border-radius: 999px; background: var(--paper-2); }
.psub > span { display: inline-flex; align-items: center; gap: 5px; }
.x { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--ink); background: var(--paper); padding: 0; }
.panel .body { padding: 12px 18px 18px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; flex: 1; }
.panel footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1.5px dashed var(--line); }
.panel h5 { margin: 14px 0 6px; font-family: var(--display); font-weight: 600; font-size: 14px; letter-spacing: .4px; text-transform: uppercase; color: var(--mut); }
.panel h5:first-child { margin-top: 2px; }
.panel h4 { margin: 0 0 2px; font-family: var(--display); font-weight: 600; font-size: 19px; display: flex; align-items: center; gap: 6px; }
.lead { margin: 0 0 12px; font-size: 17px; line-height: 1.35; }
.voice { margin: 0 0 12px; font-family: var(--voice); font-size: 17px; color: var(--ink); background: var(--paper-2); padding: 10px 14px; border-radius: 16px; }
.mut { color: var(--mut); }
p.mut { margin: 0; font-size: 15px; line-height: 1.3; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.center { text-align: center; justify-content: center; display: flex; }
p.center { display: block; }
.fine { display: flex; gap: 6px; align-items: flex-start; margin: 14px 0 0; font-size: 14px; line-height: 1.35; color: var(--mut); }
.fine .ic { margin-top: 2px; }
p.fine.center { display: flex; justify-content: center; text-align: center; align-items: center; }
.empty { margin: 8px 0 12px; padding: 18px; border-radius: 18px; border: 1.5px dashed var(--line); text-align: center; color: var(--mut); font-size: 16px; line-height: 1.35; }
.amt { display: inline-flex; align-items: center; gap: 4px; font-family: var(--display); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.badge { font-family: var(--display); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 2px 7px; border-radius: 999px; background: var(--sun); border: 1px solid var(--ink); }
.ok { display: inline-flex; align-items: center; gap: 4px; color: var(--good); font-size: 15px; }

.tabs { display: flex; gap: 4px; margin: 10px 18px 0; padding: 4px; border-radius: 999px; background: var(--paper-2); border: 1.5px solid var(--line); }
.tab { flex: 1; border: 0; background: transparent; border-radius: 999px; padding: 6px 10px; font-size: 16px; color: var(--mut); }
.tab.on { background: var(--paper-solid); color: var(--ink); box-shadow: 0 0 0 1.5px var(--ink), var(--shadow-sm); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; min-height: 40px;
  border-radius: 999px; border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow-sm); font-size: 17px; text-decoration: none; white-space: nowrap;
  transition: transform .1s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary .amt { color: var(--on-accent); }
.btn.sm { padding: 4px 12px; min-height: 32px; font-size: 15px; }
.btn.big { padding: 10px 26px; min-height: 50px; font-size: 20px; font-family: var(--display); font-weight: 600; }
.btn:disabled { opacity: .45; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.inline { display: flex; gap: 8px; }
.text { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--paper); font-size: 18px; outline: none; width: 100%; }
.p-name .text { margin: 4px 0 16px; text-align: center; font-size: 22px; }
.icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; padding: 0; border: 1.5px solid var(--line); background: var(--paper); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.slot {
  position: relative; aspect-ratio: 1; border-radius: 18px; border: 1.5px solid var(--ink); background: var(--paper-2);
  display: grid; place-items: center; padding: 4px; box-shadow: var(--shadow-sm);
}
.slot.on { background: #FFF1C9; box-shadow: 0 0 0 3px var(--accent); }
.slot.rare { background: linear-gradient(160deg, #FFF6D8, #F3E6FF); }
.slot img { width: 78%; height: 78%; object-fit: contain; background: none; }
.slot .count { position: absolute; right: 5px; bottom: 4px; min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--ink); color: var(--paper-solid); font-family: var(--display); font-weight: 600; font-size: 12px; line-height: 20px; }
.slot .nm { position: absolute; left: 6px; top: 4px; right: 6px; font-size: 11px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; opacity: 0; transition: opacity .15s; }
.slot:hover .nm { opacity: 1; }
.th { width: 50px; height: 50px; object-fit: contain; flex: none; border-radius: 14px; background: var(--paper-2); }
.th.big { width: 84px; height: 84px; border-radius: 20px; border: 1.5px solid var(--line); }
.th.mini { width: 20px; height: 20px; background: none; border-radius: 0; }
.detail { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 12px; border-radius: 20px; background: var(--row); border: 1.5px solid var(--line); flex-wrap: wrap; }
.detail.slim { margin-top: 10px; }
.dtext { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 3px; }
.dact { display: flex; flex-direction: column; gap: 6px; }
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1.5px dashed var(--line); }
.row:last-child { border-bottom: 0; }
.row.dim .th { opacity: .65; }
.rtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rtext b { font-family: var(--display); font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.costs { display: flex; flex-wrap: wrap; gap: 6px; }
.cost { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px 1px 4px; border-radius: 999px; background: var(--paper-2); font-family: var(--display); font-weight: 500; font-size: 13px; }
.cost.lack { background: #FFE8E1; color: var(--bad); }
.price { flex: none; }
button.row.wallet { width: 100%; border: 1.5px solid var(--ink); border-radius: 18px; background: var(--paper); margin-bottom: 8px; padding: 10px 14px; text-align: left; box-shadow: var(--shadow-sm); }
.wicon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.wcard { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 22px; background: linear-gradient(160deg, #E5F4FB, #FFF4E6); border: 1.5px solid var(--ink); }
.wtop { display: flex; align-items: center; gap: 8px; }
.wtop b { font-family: var(--display); font-weight: 600; }
.wtop .icon { margin-left: auto; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mut); }
.dot.ok { background: var(--rh); }
.dot.bad { background: var(--bad); }
.bal { display: flex; align-items: center; gap: 8px; }
.bal .big { font-family: var(--display); font-weight: 700; font-size: 34px; font-variant-numeric: tabular-nums; }
.gate { display: flex; align-items: center; gap: 6px; font-size: 15px; padding: 6px 12px; border-radius: 14px; background: #FFE9D6; }
.gate.ok { background: #EAF7E4; color: var(--good); }
.banner { display: flex; align-items: center; gap: 12px; padding: 14px; margin-bottom: 12px; border-radius: 20px; background: #FFF1C9; border: 1.5px solid var(--ink); flex-wrap: wrap; }
.banner > div { flex: 1; min-width: 200px; }
.banner b { font-family: var(--display); font-weight: 600; }
.banner.soft { background: var(--paper-2); border-color: var(--line); font-size: 15px; line-height: 1.35; flex-wrap: nowrap; align-items: flex-start; }
.result { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; padding: 10px; border-radius: 16px; background: #FFF1C9; border: 1.5px solid var(--ink); font-size: 18px; animation: pop .3s ease-out; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chips .chip { min-height: 32px; padding: 4px 14px; font-size: 16px; }
.chips .chip.on { background: var(--ink); color: var(--paper-solid); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--c); padding: 0; box-shadow: var(--shadow-sm); }
.sw.on { box-shadow: 0 0 0 3px var(--paper-solid), 0 0 0 5px var(--ink); }
.hatgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.hatpick { position: relative; aspect-ratio: 1; border-radius: 16px; border: 1.5px solid var(--ink); background: var(--paper-2); padding: 3px; display: grid; place-items: center; }
.hatpick img { width: 100%; height: 100%; object-fit: contain; }
.hatpick.on { background: #FFF1C9; box-shadow: 0 0 0 3px var(--accent); }
.hatpick.locked img { opacity: .55; filter: grayscale(.3); }
.hatpick .lock { position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); padding: 1px 6px; border-radius: 999px; background: var(--paper-solid); border: 1.5px solid var(--ink); display: inline-flex; white-space: nowrap; }
.hatpick .lock .amt { font-size: 11px; gap: 2px; }
.hatpick .lock .ic { width: 12px; height: 12px; }
.hatpick .none { color: var(--mut); }
.hats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.hat { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--paper); text-align: center; }
.hat img { width: 70px; height: 70px; object-fit: contain; }
.hat b { font-family: var(--display); font-weight: 600; font-size: 14px; }
.hat .mut { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }

.mapwrap { border-radius: 20px; background: linear-gradient(180deg, #DDF0FA, #F4FAFD); border: 1.5px solid var(--line); padding: 8px; display: grid; place-items: center; }
.skymap { width: 100%; max-height: calc(46 * var(--vh)); }
.skymap .br { stroke: var(--ink); stroke-width: 6px; stroke-linecap: round; opacity: .55; }
.skymap .isle circle { fill: #BFE3A6; stroke: var(--ink); stroke-width: 2.5px; cursor: pointer; }
.skymap .isle.plaza circle { fill: var(--teal); }
.skymap .isle.me circle { fill: var(--accent); }
.skymap .isle text { font-family: var(--display); font-weight: 600; font-size: 11px; fill: var(--ink); text-anchor: middle; pointer-events: none; }
.skymap .isle.me text { fill: #fff; }
.skymap .spot { fill: rgba(255, 255, 255, .6); stroke: var(--ink); stroke-width: 2px; stroke-dasharray: 5 5; cursor: pointer; }
.skymap .plus { font-family: var(--display); font-weight: 600; font-size: 18px; fill: var(--ink); text-anchor: middle; pointer-events: none; }

.wheelwrap { display: grid; place-items: center; margin: 4px 0 8px; }
.wheel { width: min(300px, calc(76 * var(--vw))); height: auto; overflow: visible; filter: drop-shadow(0 8px 14px rgba(20, 40, 60, .2)); }
.wheel .spin { transform-origin: 150px 150px; transform-box: view-box; }
.wheel path { stroke: var(--ink); stroke-width: 2px; stroke-linejoin: round; }
.wheel .rim { fill: var(--paper-2); stroke: var(--ink); stroke-width: 3px; }
.wheel .edge { fill: none; stroke: var(--ink); stroke-width: 3px; }
.wheel .hub { fill: var(--sun); stroke: var(--ink); stroke-width: 3px; }
.wheel .ptr { fill: var(--accent); stroke: var(--ink); stroke-width: 3px; stroke-linejoin: round; }
.wheel .wl { font-family: var(--display); font-weight: 600; font-size: 15px; fill: var(--ink); text-anchor: middle; }
.wheel .wc { fill: var(--sun); stroke: var(--ink); stroke-width: 1.5px; }

.quest .bar { height: 10px; border-radius: 999px; background: var(--paper-2); border: 1.5px solid var(--line); overflow: hidden; }
.quest .bar i { display: block; height: 100%; background: var(--leaf); transform-origin: left; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.keys div { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.priceinput { display: flex; align-items: center; gap: 8px; }
.num { width: 140px; height: 42px; padding: 0 12px; border-radius: 14px; border: 1.5px solid var(--ink); background: var(--paper); font-family: var(--display); font-weight: 600; font-size: 18px; outline: none; }

/* ---------- small screens ---------- */
html.w-md .tr { max-width: calc(52 * var(--vw)); gap: 6px; }
  html.w-md .rb { width: 40px; height: 40px; }
  html.w-md .rb.big { width: 50px; height: 50px; }
  html.w-md .chip { min-height: 32px; font-size: 15px; }
  html.w-md .chip.quest { max-width: calc(46 * var(--vw)); }
  html.w-md #emotes button { padding: 3px 8px; font-size: 14px; }
  html.w-md .btn-play { font-size: 26px; min-height: 58px; padding-right: 38px; }
  html.w-md .btn-play .pc { width: 38px; height: 38px; }
  html.w-md .foot .sep { display: none; }
html.w-sm .tr { gap: 5px; }
  html.w-sm .tr .rb { width: 38px; height: 38px; }
  html.w-sm #panel-wrap, html.w-sm #panel-wrap.side { place-items: end center; padding: 0; }
  html.w-sm .panel, html.w-sm .side .panel { width: calc(100 * var(--vw)); max-height: calc(82 * var(--vh)); border-radius: 26px 26px 0 0; border-bottom: 0; padding-bottom: var(--sa-b); }
  html.w-sm #panel-wrap.side { background: transparent; }
  html.w-sm .side .panel { max-height: calc(52 * var(--vh)); }
  html.w-sm .tr { max-width: calc(46 * var(--vw)); }
  html.w-sm .meters .chip { padding-right: 10px; }
  html.w-sm .bl { display: none; }
  html.w-sm body.touch .bl { display: flex; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---- v2 economy ui ---- */
/* Everything below belongs to the v2 UI (ui.js, fishing.js). Keep it at the end of the file. */

/* landing */
.logo .word text { font-size: 132px; letter-spacing: 0; }
.btn-play .pl { white-space: nowrap; }
.btn-play.wallet { font-size: 24px; padding-right: 30px; }
.btn-play.wallet .pc { background: var(--teal); color: var(--ink); }
/* the long wallet label shrinks and wraps instead of pushing the row off-screen */
.cta { max-width: 100%; min-width: 0; }
.cta-row > .rb { flex: none; }
.btn-play.wallet .pl { white-space: normal; line-height: 1.05; text-wrap: balance; }
html.w-md .btn-play.wallet { font-size: 18px; padding-right: 20px; }
body.joining .btn-play .pc .ic { animation: spin 1.2s linear infinite; }
#btn-buy .ic, #chip-token .ic, #chip-gold .ic { flex: none; }

/* amounts + currency badges */
.amt.tok { color: #1F6E66; }
.btn.primary .amt.tok, .btn.primary .amt.gold { color: var(--on-accent); }
.psub .dual { display: inline-flex; gap: 10px; }
.cur { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 3px; border-radius: 999px; font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: .3px; border: 1px solid var(--ink); white-space: nowrap; }
.cur.gold { background: #FFF1C9; }
.cur.tok { background: #DDF4F1; }
.row.listing .price { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.have { font-family: var(--display); font-weight: 500; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--paper-2); color: var(--mut); }
.hint { color: #1F6E66; }
.lack { color: var(--bad); }
.badge.soft { background: var(--paper-2); border-color: var(--line); color: var(--mut); }
.linkish { border: 0; background: none; padding: 2px 4px; color: var(--sky-dk); font-size: 15px; text-decoration: underline; text-underline-offset: 3px; margin-left: auto; }
body.touch .linkish { min-height: 32px; padding: 6px 8px; }
body.touch p.fine a { display: inline-block; padding: 7px 4px; margin: -7px -4px; }
.spinner.big { width: 34px; height: 34px; border-width: 4px; }
.slot.fishy { background: linear-gradient(170deg, #E6F4FB, var(--paper-2)); }
.slot .nm { pointer-events: none; }

/* HUD extras */
html:not(.w-md) .tr { max-width: min(560px, calc(68 * var(--vw))); }
.tr .rb[data-count]:not([data-count="0"])::after {
  content: attr(data-count); position: absolute; transform: translate(14px, -14px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--leaf); color: #fff; border: 1.5px solid var(--ink); font-family: var(--display); font-weight: 600; font-size: 10px; line-height: 15px; text-align: center;
}
.tr .rb { position: relative; }
#prompt .pex { font-family: var(--display); font-weight: 500; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #FDE3EA; color: #A23B5B; }
#prompt .pex.lack { background: #FFE8E1; color: var(--bad); }
#xpbar {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px;
  background: var(--paper-solid); border: 1.5px solid var(--ink); box-shadow: var(--shadow-sm); font-size: 15px; white-space: nowrap;
}
#xpbar.show { animation: xp-in .3s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes xp-in { from { transform: translateY(8px) scale(.9); opacity: 0; } }
#xpbar .xi { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #EAF7E4; border: 1.5px solid var(--ink); color: var(--good); }
#xpbar .xn { font-family: var(--display); font-weight: 600; font-size: 13px; }
#xpbar .xn b { font-weight: 600; color: var(--mut); }
#xpbar .xb { width: 92px; height: 9px; border-radius: 999px; background: var(--paper-2); border: 1.5px solid var(--line); overflow: hidden; }
#xpbar .xb i { display: block; height: 100%; background: linear-gradient(90deg, var(--leaf), #A7D49B); transform-origin: left; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
#xpbar .xg { font-family: var(--display); font-weight: 600; font-size: 13px; color: var(--accent-dk); }
.toast.level { background: linear-gradient(180deg, #FFF8DE, #FFE7A8); font-family: var(--display); font-weight: 600; font-size: 16px; color: var(--ink); }
.toast.level .ic { color: var(--accent); }
#chatlog .line.feed { background: #FFF1C9; }
body.fishing #prompt, body.fishing #emotes { display: none; }
body.touch #act.fish { opacity: 1; background: var(--sky-dk); color: #fff; font-size: 0; }
body.touch #act.fish::after { content: "Reel"; font-size: 18px; }

/* panels: sizes + sheet */
.p-join, .p-friend { width: min(620px, calc(calc(100 * var(--vw)) - 32px)); }
.p-dex, .p-merchant, .p-market { width: min(620px, calc(calc(100 * var(--vw)) - 32px)); }
#panel-wrap.sheet { background: rgba(30, 50, 70, .24); backdrop-filter: blur(2px); }
.panel footer { flex-wrap: wrap; }

/* join stepper */
.stepper { list-style: none; display: flex; align-items: center; gap: 4px; margin: 0 0 14px; padding: 0; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 6px; color: var(--mut); font-family: var(--display); font-weight: 500; font-size: 14px; min-width: 0; }
.stepper li:not(:last-child)::after { content: ""; flex: 1; height: 2px; border-radius: 2px; background: var(--line); margin: 0 4px; min-width: 8px; }
.stepper li.done::after { background: var(--leaf); }
.stepper .sdot { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); background: var(--paper); font-weight: 600; }
.stepper li.on { color: var(--ink); }
.stepper li.on .sdot { background: var(--accent); color: #fff; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(242, 123, 53, .2); }
.stepper li.done .sdot { background: var(--leaf); color: #fff; border-color: var(--ink); }
.stepper .slabel { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wallets button.row.wallet { display: flex; }
button.row.wallet:disabled { opacity: .55; }
.deeplinks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.deeplink { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 18px; border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm); }
.deeplink b { flex: 1; font-family: var(--display); font-weight: 600; font-size: 15px; }
.deeplink .dl { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--c); color: #fff; font-family: var(--display); font-weight: 700; font-size: 16px; border: 1.5px solid var(--ink); }
.deeplink:active { transform: translateY(1px); box-shadow: none; }
.wcard.slim { gap: 4px; padding: 12px 14px; }
.wcard .wicon { background: var(--paper); border: 1.5px solid var(--line); }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1.5px dashed var(--line); }
.check > div { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.check b { font-family: var(--display); font-weight: 600; font-size: 16px; }
.check .mut { font-size: 14px; }
.cdot { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--ink); background: var(--paper); color: var(--mut); }
.check.ok .cdot { background: var(--leaf); color: #fff; }
.jerr { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border-radius: 16px; background: #FFE8E1; border: 1.5px solid #E7A493; color: #8A2414; font-size: 15px; line-height: 1.3; }
.jerr .ic { margin-top: 2px; }
.jbusy { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 14px; border-radius: 16px; background: #E5F4FB; border: 1.5px solid var(--sky); font-size: 15px; animation: pop .2s ease-out; }
.gatecard { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; padding: 14px; border-radius: 20px; background: #FFF1C9; border: 1.5px solid var(--ink); }
.gatecard b { font-family: var(--display); font-weight: 600; font-size: 17px; }
.gatecard p.mut { margin-top: 2px; }
.gatecard .btnrow { margin-top: 10px; }
.gico { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--paper-solid); border: 1.5px solid var(--ink); color: var(--accent); }
.starters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.starter {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 8px 12px; border-radius: 22px; overflow: hidden;
  border: 2px solid var(--ink); background: var(--paper-solid); box-shadow: var(--shadow-sm); text-align: center; transition: transform .15s ease, box-shadow .15s ease;
}
.starter .sbg { position: absolute; inset: 0; background: radial-gradient(110% 70% at 50% 22%, color-mix(in srgb, var(--t) 55%, #fff) 0%, color-mix(in srgb, var(--t) 18%, #FFF9EE) 55%, #FFF9EE 80%); z-index: 0; }
.starter > *:not(.sbg) { position: relative; z-index: 1; }
.starter img.portrait { width: 100%; max-width: 168px; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(40, 60, 80, .18)); }
.starter b { font-family: var(--display); font-weight: 700; font-size: 20px; }
.starter .blurb { font-family: var(--voice); font-size: 14px; line-height: 1.25; color: var(--mut); }
.starter:hover { transform: translateY(-2px); }
.starter.on { box-shadow: 0 0 0 3px var(--accent), var(--shadow); transform: translateY(-4px); }
.starter.on::after { content: "✓"; position: absolute; right: 8px; top: 8px; z-index: 2; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; border: 1.5px solid var(--ink); font-family: var(--display); font-weight: 700; font-size: 14px; }
.starter.on img.portrait { animation: hop 1.4s ease-in-out infinite; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-7px); } 55% { transform: translateY(0) scale(1.03, .97); } }
.namerow { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.namerow .text { flex: none; text-align: center; font-size: 20px; }
.entering { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 0 14px; text-align: center; }
.entering b { font-family: var(--display); font-weight: 600; font-size: 22px; }

/* creature portraits + type/rarity chips */
img.cr { display: block; object-fit: contain; }
img.cr:not(.ready) { background: radial-gradient(circle at 50% 55%, rgba(58, 46, 42, .08) 0 38%, transparent 39%); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .55; } }
.type { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px 1px 6px; border-radius: 999px; border: 1px solid var(--ink); background: color-mix(in srgb, var(--t) 30%, #FFF9EE); font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: .3px; text-transform: uppercase; color: var(--ink); }
.type::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--t); border: 1px solid var(--ink); }
.rar { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--ink); font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: .3px; text-transform: uppercase; background: var(--paper-2); }
.rar.r-uncommon { background: #DDF4F1; }
.rar.r-rare { background: #E7DDFB; }
.rar.r-mythic { background: linear-gradient(90deg, #FFE7A8, #F9C8DD, #CDE7FF); }
.rar.r-shiny { background: #FFF1C9; }
.chips.center { justify-content: center; }

/* wardrobe pickers */
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 8px; }
.cpick { position: relative; aspect-ratio: .86; border-radius: 18px; border: 1.5px solid var(--ink); background: radial-gradient(circle at 50% 40%, #FFFFFF, var(--paper-2) 70%); padding: 4px 4px 18px; display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.cpick img.cr { width: 100%; height: 100%; }
.cpick .nm { position: absolute; left: 4px; right: 4px; bottom: 3px; font-family: var(--display); font-weight: 500; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--mut); }
.cpick.on { background: radial-gradient(circle at 50% 40%, #FFFFFF, #FFF1C9 70%); box-shadow: 0 0 0 3px var(--accent); }
.cpick.on .nm { color: var(--ink); }
.cpick.more { border-style: dashed; color: var(--mut); background: transparent; box-shadow: none; }
.vrow { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 2px; }
.vsw {
  position: relative; width: 38px; height: 38px; border-radius: 50%; padding: 0; display: grid; place-items: center; border: 1.5px solid var(--ink);
  background: radial-gradient(circle at 50% 66%, var(--b) 0 28%, var(--a) 29% 100%); box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--c) 75%, transparent), var(--shadow-sm); color: var(--ink);
}
.vsw.on { box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--c) 75%, transparent), 0 0 0 3px var(--paper-solid), 0 0 0 5px var(--accent); }
.vsw.shiny:not(.locked) { color: #B07A00; }
.vsw.shiny:not(.locked)::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; background: conic-gradient(from 0deg, #FFE48A, #F9C8DD, #CDE7FF, #FFE48A); z-index: -1; animation: spin 4s linear infinite; }
.vsw.locked { filter: grayscale(.85) opacity(.5); }
.vsw.locked .ic { color: var(--ink); }
.hatpick img { border-radius: 12px; }

/* dex */
.dexgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.dexcard {
  position: relative; aspect-ratio: .82; border-radius: 18px; border: 1.5px solid var(--ink); padding: 18px 4px 20px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, #FFFFFF, #EAF5E2 75%); box-shadow: var(--shadow-sm); overflow: hidden;
}
.dexcard img.cr { width: 100%; height: 100%; }
.dexcard .no { position: absolute; left: 7px; top: 4px; font-family: var(--display); font-weight: 600; font-size: 10px; color: var(--mut); }
.dexcard .nm { position: absolute; left: 4px; right: 4px; bottom: 3px; font-family: var(--display); font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dexcard.unknown { background: radial-gradient(circle at 50% 45%, #F7F2E8, var(--paper-2) 75%); border-color: rgba(58, 46, 42, .45); }
.dexcard.unknown .nm { color: var(--mut); letter-spacing: 2px; }
.dexcard.unknown img.cr.ready, .dexdetail.unknown img.cr.ready { filter: brightness(0) opacity(.2); }
.dexcard.on { box-shadow: 0 0 0 3px var(--accent); }
.dexcard.shiny::after { content: ""; position: absolute; right: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: conic-gradient(#FFE48A, #F9C8DD, #CDE7FF, #FFE48A); border: 1px solid var(--ink); }
.dexdetail { align-items: flex-start; }
.dexdetail img.cr.big { width: 150px; height: 150px; flex: none; border-radius: 22px; border: 1.5px solid var(--line); background: radial-gradient(circle at 50% 42%, #FFFFFF, #EAF5E2 78%); }
.dexdetail.unknown img.cr.big { background: radial-gradient(circle at 50% 42%, #FFFFFF, var(--paper-2) 78%); }
.dexdetail h4 { flex-wrap: wrap; }
.dexdetail .vrow { margin-top: 6px; }
.btn.charm { background: linear-gradient(90deg, #FFF1C9, #F9DDEA); }

/* skills */
.skills { display: flex; flex-direction: column; gap: 8px; }
.skill { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 18px; background: var(--row); border: 1.5px solid var(--line); }
.sico { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--ink); background: #EAF7E4; color: var(--good); }
.s-fishing .sico { background: #E3F2FB; color: var(--sky-dk); }
.s-bonding .sico { background: #FDE3EA; color: #C24A6E; }
.s-mining .sico, .s-salvage .sico { background: #EFEAE3; color: #6B5E57; }
.stext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.stop, .sbot { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.stop b { font-family: var(--display); font-weight: 600; font-size: 17px; }
.stop .lv { font-family: var(--display); font-weight: 700; font-size: 15px; padding: 1px 10px; border-radius: 999px; background: var(--ink); color: var(--paper-solid); }
.skill .bar { height: 10px; border-radius: 999px; background: var(--paper-2); border: 1.5px solid var(--line); overflow: hidden; }
.skill .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--leaf), #A7D49B); transform-origin: left; }
.s-fishing .bar i { background: linear-gradient(90deg, var(--sky-dk), var(--sky)); }
.s-bonding .bar i { background: linear-gradient(90deg, #E8708F, var(--pink)); }
.sbot .mut { font-size: 13px; }
.perk { font-family: var(--display); font-weight: 500; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--paper-solid); border: 1px solid var(--line); white-space: nowrap; }
.sblurb { font-size: 13px; }

/* merchant */
.tide { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.tidetxt { flex: 1; min-width: 220px; }
.tidetxt .voice { margin: 0; height: 100%; }
.tideclock { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 14px; border-radius: 16px; background: #DDF4F1; border: 1.5px solid var(--ink); font-size: 13px; color: var(--mut); min-width: 112px; }
.tideclock .ic { color: #1F6E66; }
.tideclock .until { font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.mult { font-family: var(--display); font-weight: 700; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff; border: 1px solid var(--ink); }
.pips { display: flex; gap: 3px; }
.pips i { width: 14px; height: 6px; border-radius: 3px; background: var(--paper-2); border: 1px solid var(--line); }
.pips i.on { background: var(--leaf); border-color: var(--good); }
.specials { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.special { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px 10px; border-radius: 20px; border: 1.5px solid var(--ink); background: linear-gradient(170deg, #FFFFFF, #EAF6FB); text-align: center; overflow: hidden; }
.special b { font-family: var(--display); font-weight: 600; font-size: 14px; }
.special .mut { font-size: 13px; }
.special.dim { opacity: .6; }
.special .ribbon { position: absolute; top: 10px; right: -26px; transform: rotate(35deg); padding: 2px 28px; background: var(--accent); color: #fff; font-family: var(--display); font-weight: 600; font-size: 10px; border-block: 1px solid var(--ink); }
.special .was { font-size: 12px; color: var(--mut); text-decoration: line-through; }
.row.want .rtext { gap: 4px; }

/* fishmonger */
.fishboard { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.fishcard { display: grid; grid-template-columns: 50px 1fr; grid-template-rows: auto auto auto; column-gap: 8px; align-items: center; padding: 8px; border-radius: 16px; background: linear-gradient(170deg, #F2FAFE, var(--paper)); border: 1.5px solid var(--line); }
.fishcard .th { grid-row: span 3; }
.fishcard b { font-family: var(--display); font-weight: 600; font-size: 14px; }
.fishcard .mut { font-size: 12px; }
.fishcard.rare { background: linear-gradient(170deg, #FFF6D8, #FFE7A8); border-color: var(--ink); }

/* market */
.chips.filter { margin-bottom: 10px; }
.seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 999px; background: var(--paper-2); border: 1.5px solid var(--line); align-self: flex-start; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; border-radius: 999px; padding: 5px 12px; font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--mut); }
.seg button.on { background: var(--paper-solid); color: var(--ink); box-shadow: 0 0 0 1.5px var(--ink), var(--shadow-sm); }
body.touch .seg button { min-height: 32px; }
.formrow { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.formrow label { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.num.qty { width: 84px; }
.proceeds { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; font-size: 14px; color: var(--mut); }
.proceeds > span { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sellform .dact { align-self: flex-end; }
.fees { display: grid; gap: 6px; margin-top: 14px; padding: 10px 12px; border-radius: 16px; background: var(--row); border: 1.5px dashed var(--line); font-size: 14px; line-height: 1.3; color: var(--mut); }
.fees > div { display: flex; gap: 8px; align-items: flex-start; }
.fees .cur { margin-top: 1px; }

/* quests + travel */
.qi { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); border: 1.5px solid var(--line); color: var(--mut); }
.row.quest.ready .qi { background: #FFF1C9; border-color: var(--ink); color: var(--accent-dk); }
.row.quest.ready { background: linear-gradient(90deg, rgba(255, 241, 201, .7), transparent); border-radius: 14px; }
.travel { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.until { font-variant-numeric: tabular-nums; }

/* befriend result */
.friend { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding-top: 4px; overflow: hidden; }
.friend .rays {
  position: absolute; left: 50%; top: 120px; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(242, 193, 78, .28) 0 10deg, transparent 10deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 62%); mask: radial-gradient(circle, #000 18%, transparent 62%);
  animation: spin 24s linear infinite;
}
.friend.shiny .rays { background: repeating-conic-gradient(from 0deg, rgba(249, 200, 221, .45) 0 9deg, rgba(205, 231, 255, .4) 9deg 18deg, transparent 18deg 26deg); }
.friend img.hero { position: relative; width: min(240px, calc(62 * var(--vw))); aspect-ratio: 1; filter: drop-shadow(0 12px 16px rgba(40, 60, 80, .22)); animation: friend-pop .7s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes friend-pop { from { transform: scale(.4) translateY(30px); opacity: 0; } }
.friend h3 { position: relative; margin: 0; font-family: var(--display); font-weight: 700; font-size: 28px; color: var(--ink); }
.friend .chips { position: relative; margin: 0; }
.friend .voice { position: relative; margin: 4px 0 0; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -12px; left: calc(6% + var(--i) * 6.6%); width: 9px; height: 13px; border-radius: 5px; background: var(--accent); opacity: 0; animation: confetti 2.4s ease-in calc(var(--i) * 70ms) 1 forwards; }
.confetti i:nth-child(3n) { background: var(--teal); border-radius: 50%; width: 10px; height: 10px; }
.confetti i:nth-child(3n + 1) { background: var(--pink); }
.confetti i:nth-child(4n) { background: var(--sun); }
@keyframes confetti { 0% { opacity: 1; transform: translateY(0) rotate(0); } 100% { opacity: 0; transform: translateY(380px) rotate(540deg); } }

/* ---------- fishing overlay ---------- */
#fishing { position: absolute; inset: 0; pointer-events: none; z-index: 7; }
#fishing[hidden] { display: none !important; }
#fishing .fo-card {
  position: absolute; left: 50%; bottom: calc(var(--sa-b) + 64px); transform: translateX(-50%); width: min(360px, calc(calc(100 * var(--vw)) - 32px));
  display: grid; gap: 8px; padding: 10px; pointer-events: auto;
  background: var(--paper-solid) var(--grain); border: 2px solid var(--ink); border-radius: 24px; box-shadow: var(--shadow-card);
  animation: fo-rise .3s cubic-bezier(.2, 1.2, .4, 1);
}
@keyframes fo-rise { from { transform: translate(-50%, 18px) scale(.96); opacity: 0; } }
#fishing[data-phase="catch"] .fo-card, #fishing[data-phase="miss"] .fo-card { display: none; }
.fo-pond { position: relative; height: 112px; border-radius: 16px; overflow: hidden; border: 1.5px solid var(--ink); background: linear-gradient(180deg, #CFEBF8 0%, #FFE9D6 44%, #FFE9D6 45%); }
.fo-sun { position: absolute; right: 18px; top: 10px; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle, #FFF6C9, #F2C14E); box-shadow: 0 0 18px 6px rgba(242, 193, 78, .35); }
.fo-sea { position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; overflow: hidden; }
.fo-sea .w1 { fill: #7CC7EE; stroke: var(--ink); stroke-width: 1.5px; vector-effect: non-scaling-stroke; animation: fo-w1 7s linear infinite; }
.fo-sea .w2 { fill: #4FA6D8; animation: fo-w2 5s linear infinite; }
@keyframes fo-w1 { to { transform: translateX(-260px); } }
@keyframes fo-w2 { to { transform: translateX(-208px); } }
.fo-rod { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.fo-rod .rod { stroke: #9A6A45; stroke-width: 5px; stroke-linecap: round; fill: none; vector-effect: non-scaling-stroke; }
.fo-rod .line { stroke: rgba(255, 255, 255, .95); stroke-width: 1.4px; fill: none; vector-effect: non-scaling-stroke; transition: opacity .3s; }
#fishing[data-phase="cast"] .fo-rod .line { opacity: 0; transition-delay: 0s; }
#fishing[data-phase="bite"] .fo-rod .line { stroke: #FFF6C9; }
.fo-bobx { position: absolute; left: 62%; top: 42%; width: 0; height: 0; }
.fo-boby { position: absolute; left: -10px; top: -12px; }
.fo-bob {
  display: block; position: relative; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--ink);
  background: linear-gradient(180deg, #E3412F 0 50%, #FFF9EE 50%); box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .1);
}
.fo-bob::before { content: ""; position: absolute; left: 50%; top: -9px; width: 3px; height: 9px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); }
#fishing[data-phase="cast"] .fo-bobx { animation: fo-cast-x .75s cubic-bezier(.3, .6, .4, 1) both; }
#fishing[data-phase="cast"] .fo-boby { animation: fo-cast-y .75s ease-in both; }
@keyframes fo-cast-x { from { transform: translateX(-140px); } }
@keyframes fo-cast-y { 0% { transform: translateY(-34px); } 35% { transform: translateY(-58px); } 100% { transform: translateY(0); } }
#fishing[data-phase="wait"] .fo-boby, #fishing[data-phase="reel"] .fo-boby { animation: fo-bob 2.2s ease-in-out infinite; }
@keyframes fo-bob { 50% { transform: translateY(3px) rotate(4deg); } }
#fishing.nib[data-phase="wait"] .fo-bob { animation: fo-nib .35s ease-out; }
@keyframes fo-nib { 40% { transform: translateY(5px); } }
#fishing[data-phase="bite"] .fo-boby { animation: fo-plunge .18s ease-in-out infinite alternate; }
@keyframes fo-plunge { from { transform: translateY(8px) rotate(-10deg); } to { transform: translateY(13px) rotate(10deg); } }
.fo-rip { position: absolute; left: 62%; top: 46%; width: 0; height: 0; }
.fo-rip i { position: absolute; left: -26px; top: -6px; width: 52px; height: 12px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .9); opacity: 0; }
#fishing[data-phase="cast"] .fo-rip i { animation: fo-ripple 1.2s ease-out .7s 1; }
#fishing[data-phase="cast"] .fo-rip i:nth-child(2) { animation-delay: .85s; }
#fishing[data-phase="wait"] .fo-rip i { animation: fo-ripple 2.4s ease-out infinite; }
#fishing[data-phase="wait"] .fo-rip i:nth-child(2) { animation-delay: .8s; }
#fishing[data-phase="wait"] .fo-rip i:nth-child(3) { animation-delay: 1.6s; }
#fishing[data-phase="bite"] .fo-rip i { animation: fo-ripple .6s ease-out infinite; }
#fishing[data-phase="bite"] .fo-rip i:nth-child(2) { animation-delay: .2s; }
#fishing[data-phase="bite"] .fo-rip i:nth-child(3) { animation-delay: .4s; }
@keyframes fo-ripple { 0% { opacity: .95; transform: scale(.3); } 100% { opacity: 0; transform: scale(1.9); } }
.fo-shadow { position: absolute; left: 30%; top: 70%; width: 46px; height: 14px; border-radius: 50%; background: rgba(20, 60, 90, .28); filter: blur(1px); opacity: 0; }
#fishing[data-phase="wait"] .fo-shadow { opacity: 1; animation: fo-swim 6s ease-in-out infinite; }
#fishing[data-phase="bite"] .fo-shadow { opacity: 1; left: 57%; top: 52%; transition: all .25s; }
@keyframes fo-swim { 0%, 100% { transform: translate(0, 0) scaleX(1); } 45% { transform: translate(70px, -10px) scaleX(1); } 50% { transform: translate(72px, -10px) scaleX(-1); } 95% { transform: translate(0, 0) scaleX(-1); } }
.fo-info { display: flex; flex-direction: column; gap: 2px; padding: 0 4px; }
.fo-title { font-family: var(--display); font-weight: 600; font-size: 18px; }
.fo-sub { font-size: 14px; color: var(--mut); display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.fo-q { display: inline-flex; gap: 2px; }
.fo-q i { width: 10px; height: 6px; border-radius: 0 0 6px 6px; border: 1.5px solid var(--sky-dk); border-top: 0; }
.fo-act { display: flex; gap: 8px; }
.fo-act .fo-reel { flex: 1; }
#fishing[data-phase="bite"] .fo-reel { animation: pulse 0.5s ease-in-out infinite; }
.fo-bite { position: absolute; inset: 0; display: none; place-items: center; padding-bottom: calc(16 * var(--vh)); pointer-events: auto; touch-action: none; }
#fishing[data-phase="bite"] .fo-bite { display: grid; }
.fo-bite > * { grid-area: 1 / 1; }
.fo-burst { width: 360px; height: 360px; border-radius: 50%; background: repeating-conic-gradient(rgba(255, 249, 238, .5) 0 8deg, transparent 8deg 22deg); -webkit-mask: radial-gradient(circle, transparent 22%, #000 30%, transparent 70%); mask: radial-gradient(circle, transparent 22%, #000 30%, transparent 70%); animation: spin 6s linear infinite, fo-fade .2s ease-out; }
.fo-target { width: 150px; height: 150px; border-radius: 50%; border: 4px dashed rgba(255, 249, 238, .95); box-shadow: 0 0 0 2px rgba(58, 46, 42, .4); }
.fo-ring { width: 150px; height: 150px; border-radius: 50%; border: 7px solid var(--accent); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--ink); animation: fo-shrink var(--reel, 1000ms) linear forwards; }
@keyframes fo-shrink { from { transform: scale(2.5); opacity: .4; } 85% { opacity: 1; } to { transform: scale(1); opacity: 1; } }
.fo-bang {
  width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 40% 35%, #FFF6C9, var(--sun));
  border: 3px solid var(--ink); box-shadow: 0 6px 0 rgba(58, 46, 42, .25), 0 0 40px rgba(242, 193, 78, .6);
  font-family: var(--display); font-weight: 700; font-size: 96px; line-height: 1; color: var(--accent); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  animation: fo-bang .35s cubic-bezier(.2, 1.8, .4, 1), fo-wobble .3s ease-in-out .35s infinite alternate;
}
@keyframes fo-bang { from { transform: scale(.2) rotate(-20deg); } }
@keyframes fo-wobble { from { transform: rotate(-6deg) scale(1); } to { transform: rotate(6deg) scale(1.06); } }
@keyframes fo-fade { from { opacity: 0; } }
.fo-tip { transform: translateY(-122px); padding: 6px 14px; border-radius: 999px; background: var(--paper-solid); border: 1.5px solid var(--ink); box-shadow: var(--shadow); font-family: var(--display); font-weight: 600; font-size: 16px; display: inline-flex; gap: 5px; align-items: center; }
body.touch .fo-tip kbd, body.touch #fishing kbd { display: none; }
.fo-result {
  position: absolute; left: 50%; bottom: calc(var(--sa-b) + 64px); transform: translateX(-50%); width: min(380px, calc(calc(100 * var(--vw)) - 32px));
  display: none; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; padding: 14px; pointer-events: auto; overflow: hidden;
  animation: fo-rise .35s cubic-bezier(.2, 1.3, .4, 1);
}
#fishing[data-phase="catch"] .fo-result, #fishing[data-phase="miss"] .fo-result { display: grid; }
#fishing[data-phase="miss"] .fo-result { grid-template-columns: 1fr; }
.fo-glow { position: absolute; left: 62px; top: 58px; width: 220px; height: 220px; margin: -110px 0 0 -110px; border-radius: 50%; background: repeating-conic-gradient(rgba(242, 193, 78, .3) 0 10deg, transparent 10deg 24deg); -webkit-mask: radial-gradient(circle, #000 20%, transparent 65%); mask: radial-gradient(circle, #000 20%, transparent 65%); animation: spin 14s linear infinite; pointer-events: none; }
.fo-pic { position: relative; width: 96px; height: 96px; border-radius: 22px; background: radial-gradient(circle at 50% 40%, #FFFFFF, #E3F2FB 75%); border: 1.5px solid var(--ink); display: grid; place-items: center; }
.fo-pic .fo-thumb { width: 92%; height: 92%; object-fit: contain; animation: friend-pop .6s cubic-bezier(.2, 1.5, .4, 1); }
.fo-txt { position: relative; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fo-kicker { font-family: var(--voice); font-size: 15px; color: var(--accent-dk); }
.fo-txt h4 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 22px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fo-txt h4 small { font-size: 15px; color: var(--mut); }
.fo-txt p.mut { font-size: 14px; }
.fo-rbtns { position: relative; grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 4px; }
.fo-rbtns .fo-again { flex: 1; }

/* small screens */
html.w-sm .starters { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  html.w-sm .starter { padding: 6px 4px 10px; border-radius: 18px; }
  html.w-sm .starter b { font-size: 16px; }
  html.w-sm .starter .blurb { display: none; }
  html.w-sm .stepper .slabel { display: none; }
  html.w-sm .stepper li.on .slabel { display: inline; }
  html.w-sm .specials { grid-template-columns: 1fr 1fr; }
  html.w-sm .dexgrid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
  html.w-sm .dexdetail img.cr.big { width: 110px; height: 110px; }
  html.w-sm .deeplinks { grid-template-columns: 1fr; }
  html.w-sm .tr .rb[data-count]::after { display: none; }
  html.w-sm #xpbar .xb { width: 60px; }
  html.w-sm .fo-bang { width: 104px; height: 104px; font-size: 76px; }
  html.w-sm .fo-target, html.w-sm .fo-ring { width: 120px; height: 120px; }
html.compact #fishing .fo-card, html.compact .fo-result { bottom: calc(var(--sa-b) + 54px); }

/* ---- v2 layout: rotation-safe, landscape-first ---- */
/* viewport.js sets --app-w/--app-h to the LOGICAL size (swapped while a phone is
   force-rotated) and layout classes (w-sm/w-md/w-lg/h-sm/landscape) from it. */
:root { --vw: calc(var(--app-w, 100vw) / 100); --vh: calc(var(--app-h, 100vh) / 100); }
#app { position: fixed; inset: 0; overflow: hidden; }
#gl { width: var(--app-w, 100vw); height: var(--app-h, 100vh); }
html.force-landscape #app {
  inset: auto; top: 0; left: 0; width: var(--app-w); height: var(--app-h);
  transform: translateX(100vw) rotate(90deg); transform-origin: top left;
}
/* physical safe areas mapped onto the rotated edges */
html.force-landscape {
  --sa-l: env(safe-area-inset-top, 0px); --sa-r: env(safe-area-inset-bottom, 0px);
  --sa-t: env(safe-area-inset-right, 0px); --sa-b: env(safe-area-inset-left, 0px);
}
html.force-landscape, html.force-landscape body { overscroll-behavior: none; }

/* tagline stays readable over night skies */
.tagline { background: rgba(255, 249, 238, .74); padding: 2px 14px; border-radius: 999px; text-shadow: none; backdrop-filter: blur(4px); }

/* desktop: keep the emote bar clear of the chat box on narrower windows */
html.w-lg .bl { width: min(280px, calc(28 * var(--vw))); }
html.w-lg #toasts { top: calc(var(--sa-t) + 150px); width: min(380px, calc(44 * var(--vw))); }
html.w-lg #emotes button { padding: 3px 9px; font-size: 14px; }

/* ---------- compact (landscape phones, short windows) ---------- */
html.h-sm .tl { top: calc(var(--sa-t) + 8px); left: calc(var(--sa-l) + 10px); gap: 5px; flex-direction: row; flex-wrap: wrap; align-items: center; max-width: 44%; }
html.h-sm .meters { gap: 5px; }
html.h-sm .chip { min-height: 30px; padding: 3px 10px 3px 6px; font-size: 14px; gap: 5px; }
html.h-sm .chip b { font-size: 13px; }
html.h-sm .chip.name { font-size: 13px; }
html.h-sm .chip.quest { max-width: 100%; }
html.h-sm .tr { top: calc(var(--sa-t) + 8px); right: calc(var(--sa-r) + 10px); gap: 5px; max-width: 52%; flex-wrap: nowrap; }
html.h-sm .tr .rb { width: 36px; height: 36px; flex: none; }
html.h-sm .tr .rb .ic { width: 18px; height: 18px; }
html.h-sm #toasts { top: calc(var(--sa-t) + 52px); width: min(320px, 34%); }
html.h-sm .toast { font-size: 14px; padding: 6px 12px; }
/* below the tallest top-left cluster (three wrapped chip rows) so it never covers the quest chip */
html.h-sm #xpbar { position: fixed; left: calc(var(--sa-l) + 10px); top: calc(var(--sa-t) + 120px); bottom: auto; transform: none; width: min(230px, 30%); }
html.h-sm #netstat { bottom: auto; top: calc(var(--sa-t) + 52px); }

/* bottom: joystick left · chat + emotes centre · Use button and prompt right */
html.h-sm .bc { bottom: calc(var(--sa-b) + 8px); gap: 6px; left: 0; right: 0; transform: none; pointer-events: none; }
html.h-sm .bc > * { pointer-events: auto; }
html.h-sm #emotes { gap: 4px; }
html.h-sm #emotes button { padding: 2px 8px; font-size: 13px; }
/* keep touch targets at 32px+ on landscape phones */
html.h-sm body.touch #emotes button { min-height: 32px; padding: 4px 10px; }
html.h-sm body.touch .chip { min-height: 32px; }
html.h-sm .bl {
  left: 50%; transform: translateX(-50%); bottom: calc(var(--sa-b) + 44px);
  width: min(260px, 34%); display: flex;
}
html.h-sm #chat input { height: 32px; font-size: 14px; }
html.h-sm #chatlog .line { font-size: 13px; padding: 2px 8px; }
html.h-sm #chatlog .line:nth-last-child(n+4) { display: none; }
html.h-sm body.touch #chatlog { display: flex; }
html.h-sm body.touch #joy { left: calc(var(--sa-l) + 16px); bottom: calc(var(--sa-b) + 12px); width: 108px; height: 108px; }
html.h-sm body.touch #joy i { width: 46px; height: 46px; margin: -23px; }
html.h-sm body.touch #act { right: calc(var(--sa-r) + 18px); bottom: calc(var(--sa-b) + 20px); width: 68px; height: 68px; font-size: 16px; }
html.h-sm #prompt, html.h-sm body.touch #prompt {
  position: fixed; left: auto; right: calc(var(--sa-r) + 14px); bottom: calc(var(--sa-b) + 98px);
  max-width: 30%; font-size: 14px; padding: 4px 12px 4px 4px;
}
html.h-sm body.touch #prompt { padding-left: 12px; }
html.h-sm #placebar { bottom: calc(var(--sa-b) + 44px); padding: 5px 6px 5px 12px; font-size: 14px; }
html.h-sm body.placing .bl { display: none; }
/* fishing: drop the decorative pond so the card stays below the player and the bobber */
html.h-sm .fo-pond { display: none; }
html.h-sm body.fishing .bl { display: none; }
/* an upright phone's keyboard would open sideways over the rotated UI */
html.force-landscape #chat { display: none; }

/* panels: centred cards that fit the short height; wardrobe docks right */
html.h-sm #panel-wrap { padding: 8px; place-items: center; }
html.h-sm .panel, html.h-sm .p-join, html.h-sm .p-friend, html.h-sm .p-dex, html.h-sm .p-merchant, html.h-sm .p-market {
  width: min(660px, calc(var(--app-w) - 24px)); max-height: calc(var(--app-h) - 16px); border-radius: 22px; border-bottom: 2px solid var(--ink);
}
html.h-sm #panel-wrap.side { place-items: center end; }
html.h-sm .side .panel { width: min(380px, 46%); max-height: calc(var(--app-h) - 16px); }
html.h-sm .panel header { padding: 8px 10px 6px 14px; }
html.h-sm .ptitle { font-size: 18px; }
html.h-sm .panel .body { padding: 8px 14px 12px; }
html.h-sm .panel footer { padding: 8px 14px; }
html.h-sm .tabs { margin: 6px 14px 0; }
html.h-sm .wheel { width: min(220px, calc(42 * var(--vh))); }
html.h-sm .skymap { max-height: calc(48 * var(--vh)); }
/* join step 3: short side-by-side starter cards so the name field and Start button fit */
html.h-sm .stepper { margin-bottom: 8px; }
html.h-sm .p-join .lead { margin-bottom: 8px; font-size: 15px; line-height: 1.25; }
html.h-sm .starters { gap: 6px; margin-bottom: 8px; }
html.h-sm .starter {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 1fr auto auto 1fr;
  column-gap: 6px; row-gap: 2px; justify-items: start; text-align: left; padding: 5px 8px 5px 5px; border-radius: 18px;
}
html.h-sm .starter img.portrait { grid-row: 1 / -1; width: 60px; max-width: none; }
html.h-sm .starter b { grid-column: 2; grid-row: 2; max-width: 100%; font-size: 17px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.h-sm .starter .type { grid-column: 2; grid-row: 3; }
html.h-sm .starter .blurb { display: none; }
html.h-sm .starter.on::after { right: 5px; top: 5px; width: 20px; height: 20px; font-size: 11px; }
html.h-sm .namerow { flex-direction: row; align-items: center; gap: 10px; margin-bottom: 8px; }
html.h-sm .namerow .text { flex: 1 1 auto; height: 40px; }

/* landing on a landscape phone: two columns, everything above the fold */
html.h-sm.landscape #landing {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: 1fr auto;
  grid-template-areas: "hero cta" "foot foot"; align-items: center; column-gap: 16px; row-gap: 6px;
  padding: calc(var(--sa-t) + 8px) calc(var(--sa-r) + 16px) calc(var(--sa-b) + 8px) calc(var(--sa-l) + 16px);
}
html.h-sm.landscape .hero { grid-area: hero; align-self: center; }
html.h-sm.landscape .cta { grid-area: cta; margin: 0; align-self: center; }
html.h-sm.landscape .foot { grid-area: foot; font-size: 11px; padding: 3px 10px; gap: 4px 8px; }
html.h-sm.landscape .mascot { width: 54px; height: 54px; }
html.h-sm.landscape .logo { width: min(400px, 100%); max-height: calc(46 * var(--vh)); margin-top: -4px; }
html.h-sm.landscape .tagline { font-size: 14px; }
html.h-sm.landscape .btn-play { min-height: 50px; font-size: 20px; padding: 6px 26px 6px 8px; gap: 8px; }
html.h-sm.landscape .btn-play .pc { width: 34px; height: 34px; }
html.h-sm.landscape .btn-play.wallet { font-size: 17px; padding-right: 16px; }
html.h-sm.landscape .cta-row { gap: 10px; }
html.h-sm.landscape .rb.big { width: 46px; height: 46px; }
html.h-sm.landscape .gate-note { font-size: 12px; text-align: center; }
html.h-sm.landscape .cloud { display: none; }
.cta-row.small .pill { white-space: nowrap; }
/* narrow landscape phones (568–720 wide): even columns, tighter pills so Copy CA / Buy stay on one line */
html.h-sm.landscape.w-md #landing { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 12px; }
html.h-sm.landscape.w-md .cta-row.small { gap: 8px; }
html.h-sm.landscape.w-md .cta-row.small .pill { padding: 5px 11px; font-size: 13px; gap: 5px; }

/* short upright phones (e.g. 320x568): keep the whole landing above the fold */
html.w-sm.h-md:not(.landscape) #landing { padding-top: calc(var(--sa-t) + 10px); padding-bottom: calc(var(--sa-b) + 8px); }
html.w-sm.h-md:not(.landscape) .mascot { width: 62px; height: 62px; }
html.w-sm.h-md:not(.landscape) .logo { width: min(300px, 84%); }
html.w-sm.h-md:not(.landscape) .tagline { font-size: 15px; }
html.w-sm.h-md:not(.landscape) .cta { gap: 8px; margin-bottom: 8px; }
html.w-sm.h-md:not(.landscape) .gate-note { font-size: 12px; }
html.w-sm.h-md:not(.landscape) .foot { font-size: 11px; padding: 4px 10px; gap: 3px 8px; }
html.w-sm.h-md:not(.landscape) .foot .stat:nth-of-type(n+3) { display: none; }
/* very small landscape (e.g. 568x320): toasts drop below the quest chip, XP bar tucks under the menu */
html.h-sm.w-md #toasts { top: calc(var(--sa-t) + 102px); width: min(300px, 48%); }
html.h-sm.w-md #xpbar { left: auto; right: calc(var(--sa-r) + 10px); top: calc(var(--sa-t) + 52px); width: min(220px, 34%); }
/* tightest landscape (under 640 wide, e.g. 568x320): name chip goes icon-only, menu buttons shrink a little */
html.h-sm.hud-tight .chip.name { padding: 3px 7px; }
html.h-sm.hud-tight .chip.name span { display: none; }
html.h-sm.hud-tight .tl { max-width: 48%; }
html.h-sm.hud-tight .tr { gap: 4px; max-width: none; }
html.h-sm.hud-tight .tr .rb { width: 34px; height: 34px; }
