:root {
  --bg1: #7c3aed; --bg2: #ec4899; --bg3: #f97316;
  --ink: #1f1235; --muted: #6b7280; --card: #ffffff; --line: #1f1235;
  --green: #22c55e; --red: #ef4444; --yellow: #facc15; --blue: #38bdf8; --purple: #8b5cf6; --orange: #fb923c; --pink: #f472b6;
  --shadow: 4px 4px 0 var(--line);
  --radius: 18px;
  font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { color: var(--ink); background: linear-gradient(135deg, var(--bg1), var(--bg2) 55%, var(--bg3)); background-attachment: fixed; min-height: 100vh; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .mt { margin-top: 12px; }
.warn-text { color: #b45309; font-weight: 600; } .good-text { color: #15803d; font-weight: 600; }
code { background: #f3f4f6; padding: 2px 6px; border-radius: 6px; font-size: 13px; }

.screen { display: none; } .screen.on { display: block; }

/* buttons */
.btn { border: 3px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 12px 22px; font-weight: 700; font-size: 16px; box-shadow: var(--shadow); transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--line); }
.btn.primary { background: var(--yellow); }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: #fff; }
.btn.x { background: #000; color: #fff; }
.btn.big { font-size: 20px; padding: 16px 32px; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.5); color: #fff; border-radius: 12px; width: 38px; height: 38px; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; }
.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* start */
.start-wrap { max-width: 720px; margin: 0 auto; padding: 48px 16px 40px; text-align: center; color: #fff; }
.logo-row { font-size: 56px; display: flex; gap: 10px; justify-content: center; }
.logo-row .logo-emoji { animation: bob 2.4s ease-in-out infinite; display: inline-block; }
.logo-row .logo-emoji:nth-child(2) { animation-delay: .3s; } .logo-row .logo-emoji:nth-child(3) { animation-delay: .6s; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
.logo { font-size: clamp(44px, 9vw, 84px); font-weight: 700; line-height: 1; text-shadow: 5px 5px 0 var(--ink); margin-top: 8px; }
.logo span { font-size: .5em; display: inline-block; background: var(--yellow); color: var(--ink); padding: 2px 14px; border-radius: 999px; border: 3px solid var(--ink); text-shadow: none; transform: rotate(-6deg); vertical-align: middle; }
.tagline { font-size: 20px; font-weight: 500; opacity: .95; margin: 14px 0 28px; }
.start-btns { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.howto { display: none; background: #fff; color: var(--ink); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 20px; margin-top: 22px; text-align: left; font-size: 16px; line-height: 1.5; }
.howto.open { display: block; }
.credits { opacity: .75; font-size: 13px; margin-top: 30px; }

/* topbar */
.topbar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 10px 16px; background: rgba(31,18,53,.85); backdrop-filter: blur(10px); color: #fff; border-bottom: 3px solid var(--ink); }
.tb-left { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 17px; }
.brand { font-size: 22px; }
.hours { background: var(--yellow); color: var(--ink); padding: 3px 10px; border-radius: 999px; font-size: 14px; }
.hours.low { background: var(--red); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.tb-meters { display: flex; gap: 14px; justify-content: center; }
.meter { min-width: 160px; max-width: 260px; flex: 1; }
.mlabel { display: flex; gap: 6px; font-size: 13px; font-weight: 600; align-items: baseline; }
.mlabel b { margin-left: auto; }
.bar { height: 12px; border-radius: 999px; background: rgba(255,255,255,.2); border: 2px solid rgba(255,255,255,.5); overflow: hidden; }
.bar i { display: block; height: 100%; transition: width .5s cubic-bezier(.3,1.4,.5,1); }
.meter.mood .bar i { background: linear-gradient(90deg, var(--red), var(--yellow), var(--green)); }
.meter.trust .bar i { background: linear-gradient(90deg, var(--red), var(--orange), var(--blue)); }
.tb-right { display: flex; gap: 8px; align-items: center; }
.score { font-size: 18px; font-weight: 700; background: rgba(255,255,255,.15); padding: 6px 12px; border-radius: 12px; }
.streak { font-size: 13px; font-weight: 700; background: var(--orange); color: var(--ink); padding: 4px 10px; border-radius: 999px; animation: pulse 1.2s infinite; }
.feed-toggle { display: none; }

/* layout */
.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr) 300px; gap: 16px; padding: 16px; max-width: 1500px; margin: 0 auto; align-items: start; padding-bottom: 120px; }
.queue, .feed { background: var(--card); border: 3px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); position: sticky; top: 82px; max-height: calc(100vh - 200px); display: flex; flex-direction: column; overflow: hidden; }
.queue h3, .feed-head { padding: 12px 14px; font-size: 16px; border-bottom: 3px solid var(--line); background: #fdf4ff; }
.feed-head { display: flex; justify-content: space-between; align-items: center; }
.feed-head .icon-btn { color: var(--ink); border-color: var(--ink); display: none; }
.queue-list, .feed-list { overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.qcard { display: flex; align-items: center; gap: 10px; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 8px 10px; width: 100%; transition: transform .1s; }
.qcard:hover { transform: translateX(3px); }
.qcard.active { background: #fef9c3; box-shadow: 3px 3px 0 var(--line); }
.qcard.overdue { background: #fee2e2; }
.qicon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 22px; flex: none; border: 2px solid var(--line); }
.qmeta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.qmeta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.qmeta small { color: var(--muted); font-size: 12px; }
.qmeta .exp { color: #b45309; font-style: normal; font-weight: 700; }
.qface { font-size: 20px; }
.empty { padding: 16px; color: var(--muted); text-align: center; font-size: 14px; }

/* review */
.review { background: var(--card); border: 3px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; min-height: 400px; animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.97); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.review-empty { padding: 60px 20px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.big-emoji { font-size: 72px; }
.app-head { display: flex; gap: 16px; padding: 18px; align-items: center; background: color-mix(in srgb, var(--c) 18%, #fff); border-bottom: 3px solid var(--line); }
.app-icon { width: 76px; height: 76px; border-radius: 20px; display: grid; place-items: center; font-size: 42px; border: 3px solid var(--line); box-shadow: var(--shadow); flex: none; }
.app-title h2 { font-size: 24px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.app-sub { font-size: 14px; color: #4b5563; margin-top: 2px; }
.app-status { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 2px solid var(--line); background: #fff; }
.pill.wait { background: #fee2e2; } .pill.new { background: #dcfce7; } .pill.ok { background: #e0f2fe; } .pill.warn { background: #fef3c7; }
.badge.exp { font-size: 12px; background: var(--yellow); border: 2px solid var(--line); padding: 2px 8px; border-radius: 999px; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; padding: 14px; }
.panel { border: 2px solid var(--line); border-radius: 14px; padding: 12px; background: #fff; font-size: 14px; }
.panel h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: #4b5563; margin-bottom: 8px; }
.panel ul { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.panel.scan { background: #0f172a; color: #e2e8f0; border-color: #0f172a; grid-column: 1 / -1; }
.panel.scan h4 { color: #94a3b8; }
.flag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; padding: 5px 8px; border-radius: 8px; }
.flag.red { background: rgba(239,68,68,.2); } .flag.yel { background: rgba(250,204,21,.18); } .flag.grn { background: rgba(34,197,94,.15); }
.panel.reveal { background: #f0fdf4; border-color: #16a34a; grid-column: 1 / -1; animation: pop .3s; }
.log { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: #052e16; color: #bbf7d0; padding: 10px; border-radius: 10px; }
.log.reply { background: #fff7ed; color: #7c2d12; font-family: inherit; font-size: 15px; font-style: italic; }
.diff .line { font-family: ui-monospace, Menlo, monospace; font-size: 13px; padding: 3px 8px; border-radius: 6px; }
.diff .add { background: #dcfce7; color: #14532d; } .diff .del { background: #fee2e2; color: #7f1d1d; text-decoration: line-through; }
.desc { margin-top: 8px; font-style: italic; color: #374151; }
.kv { font-weight: 600; } .hist li { font-size: 13px; }
.shots { display: flex; gap: 10px; }
.shot { flex: 1; aspect-ratio: 9/16; max-height: 150px; border: 2px solid var(--line); border-radius: 12px; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 40%, #fff), color-mix(in srgb, var(--c) 85%, #000)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.shot span { font-size: 28px; } .shot small { font-size: 11px; text-align: center; padding: 0 6px; font-weight: 600; }
.price { font-weight: 700; color: #065f46; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .chip { background: #ede9fe; border: 2px solid #c4b5fd; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.note { background: #fefce8; border-radius: 10px; padding: 8px 10px; font-style: italic; }
.demo { font-size: 14px; }

/* feed */
.tweet { border: 2px solid #e5e7eb; border-radius: 12px; padding: 8px 10px; font-size: 13px; line-height: 1.35; animation: pop .3s; background: #fff; }
.tweet .th { font-size: 12px; margin-bottom: 3px; }
.tweet.approved { border-color: #86efac; background: #f0fdf4; }
.tweet.rejectedUnfair, .tweet.terminatedUnfair, .tweet.scandal, .tweet.waitingLong { border-color: #fca5a5; background: #fef2f2; }
.tweet.rejectedWrongRule, .tweet.waiting, .tweet.escalated { border-color: #fde68a; background: #fffbeb; }
.tweet.mini { margin-top: 10px; text-align: left; }

/* actions */
.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; gap: 8px; justify-content: center; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(31,18,53,.9); backdrop-filter: blur(10px); border-top: 3px solid var(--ink); flex-wrap: wrap; }
.actions:empty { display: none; }
.act { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 92px; padding: 8px 10px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; color: var(--ink); font-weight: 700; box-shadow: 3px 3px 0 #000; transition: transform .08s; }
.act:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
.act:disabled { opacity: .45; }
.act .ai { font-size: 22px; } .act .al { font-size: 13px; } .act .ah { font-size: 11px; color: var(--muted); }
.act.approve { background: #bbf7d0; } .act.reject { background: #fecaca; } .act.test { background: #bae6fd; } .act.info { background: #e9d5ff; }
.act.escalate { background: #fde68a; } .act.wait { background: #e5e7eb; } .act.terminate { background: #111; color: #fff; } .act.terminate .ah { color: #aaa; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(31,18,53,.6); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.open { display: flex; }
.modal-card { background: #fff; border: 3px solid var(--line); border-radius: 22px; box-shadow: 6px 6px 0 var(--line); padding: 22px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; text-align: center; animation: pop .25s; }
.modal-title { font-size: 26px; margin-bottom: 12px; }
.modal-card p { line-height: 1.5; }
.tip { background: #fef9c3; border: 2px dashed #ca8a04; border-radius: 12px; padding: 10px; font-size: 14px; }
.notice { border-radius: 12px; padding: 10px; margin: 8px 0; font-size: 14px; text-align: left; font-weight: 600; }
.notice.bad { background: #fee2e2; color: #7f1d1d; }
.event { display: flex; gap: 14px; align-items: center; text-align: left; background: #ede9fe; border: 2px solid var(--purple); border-radius: 14px; padding: 12px; margin: 10px 0; }
.event-icon { font-size: 40px; } .event-title { font-weight: 700; font-size: 17px; } .event-text { font-size: 14px; line-height: 1.4; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.stat { background: #f3f4f6; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.stat b { font-size: 24px; } .stat span { font-size: 12px; color: var(--muted); }
.stat.neg b { color: var(--red); } .stat.pos b { color: #15803d; }
.rules { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.rule { display: flex; flex-direction: column; align-items: flex-start; text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 10px; transition: background .1s; }
.rule:hover { background: #fecaca; }
.rule b { font-size: 15px; } .rule span { font-size: 12px; color: #4b5563; }
.tabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.tab { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 700; } .tab.on { background: var(--yellow); }
.lb { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-height: 80px; }
.lbrow { display: grid; grid-template-columns: 30px 30px 1fr auto auto; gap: 8px; align-items: center; background: #f9fafb; border-radius: 10px; padding: 6px 10px; font-size: 14px; text-align: left; }
.lbrow .rank { font-weight: 800; color: var(--muted); } .lbrow .ldays { font-size: 12px; color: var(--muted); } .lbrow .lscore { color: #7c3aed; }
.lbrow:nth-child(1) { background: #fef3c7; } .lbrow:nth-child(2) { background: #f3f4f6; } .lbrow:nth-child(3) { background: #ffedd5; }

/* toast */
.toast { position: fixed; top: 76px; left: 50%; transform: translate(-50%, -20px); z-index: 60; background: #fff; border: 3px solid var(--line); border-radius: 14px; padding: 10px 16px; font-weight: 600; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: all .25s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { background: #dcfce7; } .toast.bad { background: #fee2e2; } .toast.warn { background: #fef3c7; } .toast.info { background: #e0f2fe; }
.toast .pts { margin-left: 6px; color: #7c3aed; }

/* game over */
.over-wrap { max-width: 640px; margin: 0 auto; padding: 32px 16px 60px; }
#over-body { background: #fff; border: 3px solid var(--line); border-radius: 24px; box-shadow: 6px 6px 0 var(--line); padding: 24px; text-align: center; }
.over-ending { font-size: clamp(24px, 6vw, 36px); font-weight: 800; }
.over-ending.fired { color: var(--red); } .over-ending.exodus { color: #b45309; } .over-ending.resigned { color: var(--purple); }
.arch-card { margin: 16px 0; padding: 20px; border-radius: 20px; background: linear-gradient(135deg, var(--bg1), var(--bg2), var(--bg3)); color: #fff; border: 3px solid var(--line); }
.arch-icon { font-size: 72px; line-height: 1; }
.arch-you { opacity: .85; font-size: 14px; margin-top: 6px; }
.arch-name { font-size: 32px; font-weight: 800; text-shadow: 3px 3px 0 var(--ink); }
.arch-desc { font-size: 15px; margin-top: 6px; opacity: .95; }
.arch-score { margin-top: 12px; font-size: 26px; font-weight: 800; background: rgba(0,0,0,.25); display: inline-block; padding: 4px 16px; border-radius: 999px; }
.share-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.submit-row { display: flex; gap: 8px; margin-top: 16px; }
.submit-row input { flex: 1; border: 3px solid var(--line); border-radius: 999px; padding: 10px 16px; font-family: inherit; font-size: 16px; min-width: 0; }

/* responsive */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .feed { position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 92vw); max-height: none; border-radius: 0; z-index: 40; transform: translateX(105%); transition: transform .25s; }
  .feed.open { transform: none; }
  .feed-head .icon-btn, .feed-toggle { display: inline-flex; }
}
@media (max-width: 720px) {
  .topbar { grid-template-columns: 1fr auto; gap: 8px; padding: 8px 10px; }
  .tb-meters { grid-column: 1 / -1; grid-row: 2; gap: 8px; }
  .tb-right { grid-row: 1; grid-column: 2; }
  .icon-btn { width: 32px; height: 32px; font-size: 15px; }
  .meter { min-width: 0; }
  .tb-left { font-size: 15px; }
  .score { font-size: 15px; padding: 4px 8px; }
  .streak { display: none !important; }
  .layout { grid-template-columns: 1fr; padding: 10px; gap: 10px; padding-bottom: 150px; }
  .queue { position: static; max-height: none; }
  .queue-list { flex-direction: row; overflow-x: auto; padding: 8px; }
  .qcard { min-width: 190px; width: auto; }
  .app-head { padding: 12px; gap: 12px; } .app-icon { width: 60px; height: 60px; font-size: 32px; }
  .app-title h2 { font-size: 20px; }
  .panels { grid-template-columns: 1fr; padding: 10px; }
  .actions { gap: 6px; padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); }
  .act { min-width: calc(25% - 6px); padding: 6px 4px; }
  .act .al { font-size: 11px; } .act .ai { font-size: 20px; }
  .act.terminate, .act.wait, .act.escalate { min-width: calc(33.3% - 6px); }
  .rules { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .toast { top: 110px; }
}
