:root {
  --ink: #1d1b2f;
  --paper: #f7f0e1;
  --wave: #eee3cb;
  --card: #fffaf0;
  --red: #e03c31;
  --red-d: #b3271e;
  --indigo: #2b3a67;
  --gold: #e8a900;
  --matcha: #5d8f43;
  --sakura: #f9c6d0;
  --muted: #6d6780;
  --line: 2px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --display: 'Dela Gothic One', 'Zen Maru Gothic', system-ui, sans-serif;
  --pixel: 'DotGothic16', ui-monospace, monospace;
  --body: 'Zen Maru Gothic', system-ui, -apple-system, 'Hiragino Sans', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--body); color: var(--ink); font-size: 15px; line-height: 1.45;
  display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
  background-color: var(--paper);
  /* seigaiha (青海波) wave pattern */
  background-image:
    radial-gradient(circle at 100% 150%, var(--paper) 24%, var(--wave) 25%, var(--wave) 28%, var(--paper) 29%, var(--paper) 36%, var(--wave) 36%, var(--wave) 40%, transparent 40%, transparent),
    radial-gradient(circle at 0 150%, var(--paper) 24%, var(--wave) 25%, var(--wave) 28%, var(--paper) 29%, var(--paper) 36%, var(--wave) 36%, var(--wave) 40%, transparent 40%, transparent),
    radial-gradient(circle at 50% 100%, var(--wave) 10%, var(--paper) 11%, var(--paper) 23%, var(--wave) 24%, var(--wave) 30%, var(--paper) 31%, var(--paper) 43%, var(--wave) 44%, var(--wave) 50%, var(--paper) 51%, var(--paper) 63%, var(--wave) 64%, var(--wave) 71%, transparent 71%, transparent),
    radial-gradient(circle at 100% 50%, var(--wave) 5%, var(--paper) 6%, var(--paper) 15%, var(--wave) 16%, var(--wave) 20%, var(--paper) 21%, var(--paper) 30%, var(--wave) 31%, var(--wave) 35%, var(--paper) 36%, var(--paper) 45%, var(--wave) 46%, var(--wave) 49%, transparent 50%, transparent),
    radial-gradient(circle at 0 50%, var(--wave) 5%, var(--paper) 6%, var(--paper) 15%, var(--wave) 16%, var(--wave) 20%, var(--paper) 21%, var(--paper) 30%, var(--wave) 31%, var(--wave) 35%, var(--paper) 36%, var(--paper) 45%, var(--wave) 46%, var(--wave) 49%, transparent 50%, transparent);
  background-size: 80px 40px;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--indigo); font-weight: 700; }
h1, h2, h3, p, ul { margin: 0; }
ul { list-style: none; padding: 0; }
small { color: var(--muted); font-size: 12px; }
.pixel { font-family: var(--pixel); letter-spacing: .04em; }
.blink { animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- header ---------- */
#top {
  flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 14px;
  background: var(--red); color: #fff; border-bottom: 3px solid var(--ink); position: relative; z-index: 5;
}
#top::after { /* torii crossbeam */
  content: ''; position: absolute; left: 0; right: 0; bottom: -9px; height: 4px; background: var(--ink); opacity: .12;
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-mark { background: #fff; color: var(--red); font-family: var(--display); padding: 2px 8px; border: var(--line); border-radius: 8px; transform: rotate(-4deg); box-shadow: 2px 2px 0 var(--ink); }
.logo-text { font-family: var(--display); font-size: 18px; letter-spacing: .06em; text-shadow: 2px 2px 0 var(--red-d); }
.clock { margin: 0 auto; font-size: 20px; background: var(--ink); color: #9dffb0; padding: 2px 12px; border-radius: 6px; white-space: nowrap; }
.clock small { color: #7fbf8c; font-size: 11px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.net { font-size: 11px; white-space: nowrap; }
.net.off { color: #ffe08a; }
.icon-btn { background: transparent; border: 2px solid #fff; color: #fff; border-radius: 50%; width: 32px; height: 32px; }
.mechip { display: flex; align-items: center; gap: 6px; background: #fff; color: var(--ink); border: var(--line); border-radius: 999px; padding: 2px 12px 2px 4px; box-shadow: 2px 2px 0 var(--ink); }
.mechip span { font-size: 20px; }
.mechip:empty { display: none; }

/* ---------- layout ---------- */
#cols { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr) minmax(340px, 460px); }
.col { min-height: 0; overflow-y: auto; padding: 16px; scrollbar-width: thin; }
#party { border-right: var(--line); background: rgba(255, 250, 240, .6); }
#mapcol { border-left: var(--line); padding: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--card); }
#plan { max-width: 860px; width: 100%; margin: 0 auto; }
#tabs { display: none; }

@media (max-width: 1099px) {
  /* only the open tab exists on a phone; #cols itself never scrolls, so nothing can peek out underneath */
  #cols { display: block; overflow: hidden; }
  #cols > .col { display: none; height: 100%; border: 0 !important; }
  body[data-tab=party] #cols > #party, body[data-tab=plan] #cols > #plan { display: block; }
  body[data-tab=map] #cols > #mapcol { display: flex; }
  #tabs {
    flex: none; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--ink);
    padding-bottom: env(safe-area-inset-bottom);
  }
  #tabs button { background: none; border: 0; color: #b9b4cc; padding: 7px 0 8px; display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
  #tabs b { font-family: var(--display); font-size: 17px; font-weight: 400; }
  #tabs span { font-family: var(--pixel); font-size: 11px; }
  #tabs button.sel { color: #fff; background: var(--red); }
  .logo-text, .clock small, .net { display: none; }
  .clock { font-size: 17px; }
  .col { padding: 12px; }
}

/* ---------- shared bits ---------- */
.card { background: var(--card); border: var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; margin: 16px 0; }
.card h2 { font-size: 16px; font-weight: 900; margin-bottom: 8px; }
.card h2 small { font-weight: 500; margin-left: 4px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 18px 0 10px; }
.sec-head:first-child { margin-top: 0; }
.sec-head h2 { font-family: var(--display); font-weight: 400; font-size: 22px; }
.sec-head h2 span { font-family: var(--pixel); font-size: 12px; color: var(--red); margin-left: 6px; letter-spacing: .1em; }
.btn {
  background: #fff; border: var(--line); border-radius: 10px; padding: 8px 14px; font-weight: 700;
  box-shadow: 3px 3px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn.primary { background: var(--red); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 13px; box-shadow: 2px 2px 0 var(--ink); }
.btn.big { padding: 12px 18px; font-family: var(--display); font-weight: 400; font-size: 16px; width: 100%; }
.btn.danger { color: var(--red-d); }
.btn.dashed { width: 100%; border-style: dashed; box-shadow: none; background: transparent; margin-top: 8px; }
.link { background: none; border: 0; color: var(--indigo); font-weight: 700; padding: 0; text-decoration: underline; }
.mini { background: #fff; border: 1.5px solid var(--ink); border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 700; text-decoration: none; color: var(--ink); white-space: nowrap; }
.mini.danger { color: var(--red-d); border-color: var(--red-d); }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 10px; }
.empty { color: var(--muted); font-size: 13px; padding: 14px 4px; text-align: center; }
.badge { font-family: var(--pixel); font-size: 11px; background: var(--ink); color: #fff; padding: 1px 8px; border-radius: 999px; margin-left: 4px; }
.badge.live { background: var(--red); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(224, 60, 49, .25); } }

.tier { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid var(--ink); border-radius: 6px; font-family: var(--display); font-size: 12px; background: #fff; padding: 0; line-height: 1; }
.tier.big { width: 38px; height: 38px; font-size: 20px; border-width: 2px; border-radius: 10px; box-shadow: 2px 2px 0 var(--ink); flex: none; }
.tier.t5 { background: #ff6b5e; color: #fff; }
.tier.t4 { background: #ffb347; }
.tier.t3 { background: #ffe45c; }
.tier.t2 { background: #b8e986; }
.tier.t1 { background: #cfd8dc; }
.tierpick { display: inline-flex; gap: 3px; }
.tierpick .tier { opacity: .35; }
.tierpick .tier.on, .tierpick .tier:hover { opacity: 1; }
.tierpick .tier.on { box-shadow: 2px 2px 0 var(--ink); transform: translate(-1px, -1px); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; background: var(--indigo); color: #fff; border: var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 16px 18px 14px;
  background-image: radial-gradient(circle at 88% -10%, var(--red) 0 90px, transparent 91px);
}
.hero-kanji { position: absolute; right: 14px; bottom: -18px; font-family: var(--display); font-size: 96px; line-height: 1; color: rgba(255, 255, 255, .13); pointer-events: none; white-space: nowrap; }
.hero-meta { font-size: 12px; color: #cfd6f3; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.hero-meta .link { color: #fff; font-family: var(--body); font-size: 12px; }
.hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(26px, 5vw, 38px); line-height: 1.1; margin: 6px 0 2px; text-shadow: 3px 3px 0 var(--ink); }
.hero-title { font-weight: 700; font-size: 16px; }
.hero-hotel { margin-top: 8px; font-size: 13px; }
.hero-hotel a { color: #ffe08a; }
.hero-hotel small { color: #cfd6f3; }
.stampbar { position: relative; margin-top: 12px; height: 20px; background: rgba(0, 0, 0, .35); border: 2px solid #fff; border-radius: 999px; overflow: hidden; max-width: 320px; }
.stampbar i { position: absolute; inset: 0 auto 0 0; background: var(--red); transition: width .5s; }
.stampbar span { position: relative; display: block; text-align: center; font-size: 11px; line-height: 16px; }

.strip { display: flex; gap: 8px; overflow-x: auto; padding: 14px 2px 8px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.chip { flex: none; display: grid; justify-items: center; min-width: 62px; background: var(--card); border: var(--line); border-radius: 12px; padding: 5px 8px 4px; line-height: 1.15; box-shadow: 2px 2px 0 var(--ink); }
.chip b { font-size: 13px; }
.chip span { font-size: 11px; color: var(--muted); }
.chip i { font-style: normal; font-family: var(--display); font-size: 12px; color: var(--red); }
.chip.today { border-color: var(--red); box-shadow: 2px 2px 0 var(--red); }
.chip.sel { background: var(--ink); color: #fff; transform: translateY(-3px); }
.chip.sel span { color: #b9b4cc; }
.chip.sel i { color: #ffb3ab; }

/* ---------- tips ---------- */
.tips { background: #fff6d6; }
.mascot { display: inline-block; font-size: 22px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-6deg); } }
.tips li { display: flex; gap: 10px; padding: 6px 0; border-top: 1.5px dashed rgba(29, 27, 47, .2); font-size: 14px; }
.tips li:first-child { border-top: 0; }
.tips li > span { flex: none; width: 22px; text-align: center; }
.tip-go { display: block; margin-top: 2px; }

/* ---------- timeline ---------- */
.timeline { position: relative; }
.block { display: grid; grid-template-columns: 74px 1fr; gap: 10px; margin-bottom: 12px; }
.b-time { text-align: right; padding-top: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.b-time b { font-size: 17px; font-weight: 400; }
.b-time span { font-size: 11px; color: var(--muted); }
.nowtag { font-style: normal; background: var(--red); color: #fff; font-size: 11px; padding: 0 6px; border-radius: 4px; animation: blink 1.1s steps(2) infinite; }
.b-body { background: var(--card); border: var(--line); border-radius: 14px; padding: 12px; box-shadow: 3px 3px 0 var(--ink); position: relative; }
.b-body::before { content: ''; position: absolute; left: -9px; top: 16px; width: 12px; height: 12px; background: var(--card); border-left: var(--line); border-bottom: var(--line); transform: rotate(45deg); }
.block.now .b-body { border-color: var(--red); box-shadow: 4px 4px 0 var(--red); background: #fff; }
.block.now .b-body::before { border-color: var(--red); background: #fff; }
.block.past { opacity: .62; }
.b-body > p { font-size: 14px; }
.edit-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.stops { margin-top: 8px; }
.stop { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1.5px dashed rgba(29, 27, 47, .18); }
.s-name { flex: 1; min-width: 0; font-weight: 700; }
.s-name small { display: block; font-weight: 500; }
.stop.done .s-name { text-decoration: line-through; text-decoration-color: var(--red); color: var(--muted); }
.stop.done .s-name small { text-decoration: none; display: inline-block; }
.stamp {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 2px dashed var(--muted); background: transparent;
  font-family: var(--display); font-size: 16px; color: var(--red); padding: 0; line-height: 1;
}
.stamp[aria-pressed=true] { border: 3px solid var(--red); background: rgba(224, 60, 49, .08); transform: rotate(-12deg); }
.just .stamp { animation: stampin .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stampin { 0% { transform: scale(3) rotate(20deg); opacity: 0; } 60% { transform: scale(.85) rotate(-16deg); opacity: 1; } 100% { transform: scale(1) rotate(-12deg); } }
.note p { font-size: 14px; margin-bottom: 8px; }
.foot { text-align: center; color: var(--muted); font-size: 11px; padding: 10px 0 20px; }

/* ---------- party ---------- */
.party { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; }
.member { flex: none; min-width: 96px; display: grid; justify-items: center; gap: 1px; background: var(--card); border: var(--line); border-radius: 14px; padding: 8px 10px; box-shadow: 2px 2px 0 var(--ink); }
.m-av { font-size: 30px; line-height: 1.1; }
.member b { font-size: 13px; }
.member em { font-style: normal; font-family: var(--pixel); font-size: 10px; background: var(--red); color: #fff; padding: 0 4px; border-radius: 4px; }
.member small { font-size: 11px; }
.member.sel { background: var(--ink); color: #fff; transform: translateY(-2px); }
.member.sel small { color: #b9b4cc; }
.ptabs { display: grid; grid-template-columns: repeat(4, 1fr); border: var(--line); border-radius: 12px; overflow: hidden; margin-top: 8px; background: #fff; }
.ptabs button { background: none; border: 0; border-left: 1.5px solid var(--ink); padding: 6px 2px; font-size: 12px; font-weight: 700; display: grid; justify-items: center; }
.ptabs button:first-child { border-left: 0; }
.ptabs button span { font-size: 17px; }
.ptabs button.sel { background: var(--gold); }
.pbody { padding-top: 12px; }
.whose { font-size: 15px; font-weight: 900; margin-bottom: 8px; }

.hpbox { background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 12px; }
.hp-row { display: flex; justify-content: space-between; font-size: 12px; }
.hp { height: 14px; background: #3a3752; border: 2px solid #fff; border-radius: 4px; margin: 6px 0; overflow: hidden; }
.hp i { display: block; height: 100%; background: #62d26f; transition: width .5s; }
.hp.mid i { background: var(--gold); }
.hp.low i { background: var(--red); animation: blink .8s steps(2) infinite; }
.hp-note { font-size: 12px; color: #cfcbe0; }
.hp-note b { color: #ffb3ab; }
.cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.catchip { background: #fff; border: 1.5px solid var(--ink); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.ledger li { display: flex; align-items: center; gap: 8px; padding: 7px 2px; border-top: 1.5px dashed rgba(29, 27, 47, .18); }
.ledger .l-date { border-top: 0; padding: 12px 2px 2px; font-size: 12px; color: var(--red-d); }
.l-ic { font-size: 18px; }
.l-note { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.party-total { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; }

.wish { display: flex; gap: 10px; align-items: flex-start; background: var(--card); border: var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; box-shadow: 2px 2px 0 var(--ink); }
.wish.done { opacity: .55; }
.w-main { flex: 1; min-width: 0; display: grid; gap: 3px; overflow-wrap: anywhere; }
.w-main p { font-size: 13px; }
.tier-label { font-style: italic; }
.w-side { display: grid; gap: 6px; justify-items: end; }
.rank { flex: none; width: 34px; text-align: center; font-size: 15px; color: var(--red-d); padding-top: 2px; }
.voters { display: flex; gap: 8px; flex-wrap: wrap; }
.voter { display: inline-flex; align-items: center; gap: 2px; font-size: 16px; }
.voter .tier { width: 17px; height: 17px; font-size: 10px; }
.w-ctl { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 3px; }
.w-ctl select { border: 1.5px solid var(--ink); border-radius: 8px; background: #fff; font-size: 12px; padding: 2px 4px; max-width: 170px; }
.quest { display: flex; gap: 10px; padding: 10px 0; border-top: 1.5px dashed rgba(29, 27, 47, .2); }
.quest p { font-size: 13px; margin-top: 2px; }
.quest small { display: block; }
.quest.done b { text-decoration: line-through; color: var(--muted); }
.prio { font-family: var(--pixel); font-size: 10px; padding: 1px 6px; border-radius: 4px; border: 1.5px solid var(--ink); vertical-align: middle; }
.p-critical { background: var(--red); color: #fff; }
.p-high { background: var(--gold); }
.p-medium { background: #b8e986; }

/* ---------- map ---------- */
.mapbar { flex: none; padding: 10px; border-bottom: var(--line); background: var(--card); }
.mb-row { display: flex; gap: 8px; align-items: center; }
.mb-row select { flex: 1; min-width: 0; border: var(--line); border-radius: 10px; padding: 5px 6px; background: #fff; font-weight: 700; font-size: 13px; }
.mb-cats { display: flex; gap: 6px; overflow-x: auto; padding-top: 8px; scrollbar-width: none; }
.catbtn { flex: none; background: #fff; border: 1.5px solid var(--ink); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; opacity: .5; }
.catbtn.on { opacity: 1; background: var(--sakura); box-shadow: 2px 2px 0 var(--ink); }
#map { flex: 1 1 0; min-height: 200px; background: #dfe8ea; z-index: 0; }
.neartoggle { flex: none; background: var(--ink); color: #fff; border: 0; padding: 7px 10px; font-size: 12px; text-align: center; }
.near-closed .nearby { display: none; }
.map-fallback { padding: 30px; text-align: center; color: var(--muted); }
.nearby { flex: none; max-height: 40%; overflow-y: auto; padding: 8px 12px; }
.gm { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11px; padding: 4px 0 8px; color: var(--muted); }
.near li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1.5px dashed rgba(29, 27, 47, .18); }
.near li:first-child { border-top: 0; }
.n-ic { flex: none; width: 34px; height: 34px; border-radius: 50%; border: var(--line); background: #fff; font-size: 16px; padding: 0; }
.n-main { flex: 1; min-width: 0; display: grid; overflow-wrap: anywhere; }
.n-main b { font-size: 14px; }
.radar { display: grid; justify-items: center; gap: 10px; padding: 18px; }
.radar i { width: 54px; height: 54px; border-radius: 50%; border: 3px solid var(--red); background: conic-gradient(rgba(224, 60, 49, .5), transparent 35%); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pin { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--ink); font-family: var(--display); font-size: 12px; box-shadow: 2px 2px 0 rgba(29, 27, 47, .6); }
.pin-stop { background: var(--red); color: #fff; }
.pin-done { background: #fff; color: var(--red); border-color: var(--red); transform: rotate(-12deg); }
.pin-wish { background: var(--gold); color: var(--ink); font-size: 15px; }
.pin-near { background: #fff; font-size: 15px; width: 28px; height: 28px; }
.pin-me { width: 22px; height: 22px; border-radius: 50%; background: #2f7cf6; border: 3px solid #fff; box-shadow: 0 0 0 2px #2f7cf6; animation: mepulse 1.8s infinite; }
@keyframes mepulse { 0% { box-shadow: 0 0 0 2px #2f7cf6, 0 0 0 0 rgba(47, 124, 246, .5); } 100% { box-shadow: 0 0 0 2px #2f7cf6, 0 0 0 18px rgba(47, 124, 246, 0); } }
.leaflet-popup-content { font-family: var(--body); font-size: 13px; line-height: 1.5; margin: 10px 12px; }
.leaflet-popup-content .mini { margin-left: 6px; cursor: pointer; }
.leaflet-popup-content-wrapper { border: var(--line); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); }

/* ---------- login / boot ---------- */
.boot, .login { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; align-content: center; gap: 14px; background: var(--indigo); color: #fff; padding: 16px; overflow-y: auto; }
.boot-kanji { font-family: var(--display); font-size: 90px; width: 150px; height: 150px; display: grid; place-items: center; background: var(--red); border-radius: 50%; border: 4px solid #fff; animation: bob 2s ease-in-out infinite; }
.login { background: var(--indigo) radial-gradient(circle at 50% 18%, #3d4f8a 0, var(--indigo) 60%); }
.login-card { position: relative; width: min(440px, 100%); background: var(--card); color: var(--ink); border: 3px solid var(--ink); border-radius: 20px; box-shadow: 8px 8px 0 var(--ink); padding: 26px 22px 22px; text-align: center; overflow: hidden; animation: pop .4s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }
.login-sun { position: absolute; top: -70px; left: 50%; width: 200px; height: 200px; margin-left: -100px; border-radius: 50%; background: var(--red); opacity: .14; }
.login-logo { position: relative; display: inline-block; font-family: var(--display); font-size: 38px; background: var(--red); color: #fff; padding: 2px 16px; border: var(--line); border-radius: 14px; transform: rotate(-4deg); box-shadow: var(--shadow); }
.login-card h1 { font-family: var(--display); font-weight: 400; font-size: 30px; margin-top: 12px; letter-spacing: .08em; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.login-card .pixel { color: var(--red-d); margin-bottom: 12px; }
.login-or { color: var(--muted) !important; font-size: 12px; margin-top: 14px; }
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.char { display: grid; justify-items: center; background: #fff; border: var(--line); border-radius: 14px; padding: 10px 6px; box-shadow: 3px 3px 0 var(--ink); transition: transform .1s; }
.char:hover { transform: translateY(-3px) rotate(-2deg); background: var(--sakura); }
.char span { font-size: 34px; }
.newchar { display: grid; gap: 12px; }
.newchar input, .field input, .field select, .field textarea { width: 100%; border: var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; font-size: 16px; }
.avatar-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.av { aspect-ratio: 1; font-size: 20px; background: #fff; border: 1.5px solid var(--ink); border-radius: 10px; padding: 0; }
.av.sel { background: var(--gold); transform: scale(1.12) rotate(-6deg); box-shadow: 2px 2px 0 var(--ink); }

/* ---------- dialog / forms ---------- */
dialog { border: 3px solid var(--ink); border-radius: 18px; box-shadow: 8px 8px 0 var(--ink); padding: 0; width: min(440px, calc(100vw - 28px)); background: var(--card); color: var(--ink); }
dialog[open] { animation: pop .25s cubic-bezier(.2, 1.4, .4, 1); }
dialog::backdrop { background: rgba(29, 27, 47, .6); }
.form { padding: 18px; display: grid; gap: 12px; }
.form h2 { font-family: var(--display); font-weight: 400; font-size: 20px; }
.form .row-btns { justify-content: flex-end; margin: 4px 0 0; }
.field { display: grid; gap: 4px; }
.field > span { font-size: 12px; font-weight: 700; color: var(--muted); }
.tierform { display: grid; gap: 6px; }
.tierform label { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border: 1.5px solid transparent; border-radius: 12px; font-size: 13px; cursor: pointer; }
.tierform input { position: absolute; opacity: 0; }
.tierform label:has(input:checked) { border-color: var(--ink); background: #fff; box-shadow: 2px 2px 0 var(--ink); }

/* ---------- fx ---------- */
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
#snow span { position: absolute; top: -30px; color: #9fb8d9; animation: fall linear infinite; text-shadow: 0 0 2px #fff; }
@keyframes fall { 0% { transform: translate(0, -5vh) rotate(0); } 50% { transform: translate(24px, 50vh) rotate(180deg); } 100% { transform: translate(-12px, 108vh) rotate(360deg); } }
#toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; border: 2px solid #fff; border-radius: 12px; padding: 8px 14px; font-family: var(--pixel); font-size: 14px; box-shadow: 4px 4px 0 rgba(0, 0, 0, .35); animation: toastin .3s cubic-bezier(.2, 1.4, .4, 1); transition: opacity .4s, transform .4s; }
.toast.out { opacity: 0; transform: translateY(10px); }
.toast-icon { font-size: 20px; }
@keyframes toastin { from { transform: translateY(20px) scale(.9); opacity: 0; } }
.burst { position: fixed; top: -40px; z-index: 70; pointer-events: none; animation: burstfall 2.2s ease-in forwards; }
@keyframes burstfall { to { transform: translateY(110vh) rotate(540deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- profile actions / unanimous ---------- */
.prof-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 2px; }
label.av { display: grid; place-items: center; cursor: pointer; }
label.av input { position: absolute; opacity: 0; pointer-events: none; }
label.av:has(input:checked) { background: var(--gold); transform: scale(1.12) rotate(-6deg); box-shadow: 2px 2px 0 var(--ink); }
.allin { justify-self: start; background: var(--red); color: #fff; font-size: 10px; padding: 1px 8px; border-radius: 999px; border: 1.5px solid var(--ink); }

/* ---------- phone map: as much map as possible ---------- */
@media (max-width: 1099px) {
  .mapbar { padding: 6px 8px; }
  .mb-cats { padding-top: 6px; }
  .pin { width: 34px; height: 34px; font-size: 14px; }
  .leaflet-touch .leaflet-bar a { width: 38px; height: 38px; line-height: 38px; font-size: 22px; }
}

/* ---------- guide maps ---------- */
.pin-guide { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--ink); flex: none; }
.pop-desc { color: var(--muted); font-size: 12px; }
.guides li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1.5px dashed rgba(29, 27, 47, .2); }
.guides li:first-child { border-top: 0; }
.guides label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.guides label span { display: grid; min-width: 0; overflow-wrap: anywhere; }
.guides input { width: 18px; height: 18px; flex: none; }
.sug { flex: 1; min-width: 0; display: grid; overflow-wrap: anywhere; }
dialog { max-height: calc(100dvh - 40px); overflow-y: auto; }

/* ---------- guide categories ---------- */
.pin-g { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: #fff; border: 2.5px solid var(--ink); font-size: 12px; line-height: 1; box-shadow: 1px 1px 0 rgba(29, 27, 47, .5); }
.mb-label { flex: none; align-self: center; font-size: 10px; color: var(--muted); width: 44px; }
.catbtn small { color: inherit; opacity: .7; font-size: 11px; }
.pop-cat { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.pop-cat select { border: 1.5px solid var(--ink); border-radius: 8px; background: #fff; font-size: 12px; padding: 1px 4px; }

.quest > div { flex: 1; min-width: 0; }
.quest > .mini { align-self: flex-start; }

/* ---------- money / converter ---------- */
.money { display: flex; align-items: center; gap: 8px; }
.money label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; border: var(--line); border-radius: 10px; background: #fff; padding: 0 10px; }
.money label b { font-family: var(--pixel); font-size: 13px; color: var(--red-d); }
.money input { flex: 1; min-width: 0; border: 0 !important; padding: 9px 0 !important; background: transparent; font-size: 16px; outline: none; }
.money-eq { font-weight: 900; color: var(--muted); }
.sar { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.l-amt { text-align: right; }
.hp-sar { color: #cfcbe0; font-size: 11px; margin-top: -2px; }
.fxcard .fx-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 10px 0 6px; font-size: 12px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; padding-top: 12px; border-top: 1.5px dashed rgba(224, 60, 49, .5); }
.danger-zone span { font-size: 12px; font-weight: 700; color: var(--red-d); }

/* ---------- in-app confirm ---------- */
#ask { width: min(380px, calc(100vw - 28px)); }
.ask-msg { font-weight: 700; font-size: 15px; }
.btn.danger-fill { background: var(--red-d); color: #fff; }

/* ---------- passwords ---------- */
.pw-zone { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 6px; padding-top: 12px; border-top: 1.5px dashed rgba(29, 27, 47, .2); }
.pw-zone > span:first-child { font-size: 13px; font-weight: 700; }
.pw-zone em { font-style: normal; font-family: var(--pixel); font-size: 11px; background: var(--matcha); color: #fff; padding: 0 6px; border-radius: 4px; }
.pw-zone em.off { background: var(--muted); }
.pw-zone .row-btns { margin: 0; }
.pw-input { width: 100%; border: var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; font-size: 16px; }
.pw-err { color: var(--red-d); margin: 0; }
