@font-face { font-family: Fredoka; src: url(../fonts/fredoka-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Fredoka; src: url(../fonts/fredoka-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Fredoka; src: url(../fonts/fredoka-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Luckiest Guy'; src: url(../fonts/luckiest-guy-latin-400-normal.woff2) format('woff2'); font-display: swap; }

:root {
  --glass: rgba(18, 22, 34, 0.72);
  --glass-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f6f7fb;
  --muted: #aab1c4;
  --accent: #ff0033;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fc0f5; color: var(--text); font-family: Fredoka, ui-rounded, system-ui, sans-serif; }
canvas#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 12px; font-weight: 400; }
.hidden { display: none !important; }

.top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px; pointer-events: none; z-index: 5; }
.top > * { pointer-events: auto; }
.brand { display: flex; gap: 12px; align-items: center; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 20px 12px 18px; }
.brand h1 { margin: 0; white-space: nowrap; font-family: 'Luckiest Guy', Fredoka, sans-serif; font-weight: 400; line-height: 0.9; }
.brand h1 .t1 { display: block; font-size: 15px; letter-spacing: 4px; color: #ffd23f; padding-top: 3px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.brand h1 .t2 { display: block; font-size: 34px; letter-spacing: 1.5px; padding-top: 5px; color: #fff; text-shadow: 0 1px 0 #d9dbe6, 0 2px 0 #b9bccb, 0 3px 0 #9a9eb0, 0 4px 0 #7d8196, 0 6px 10px rgba(0, 0, 0, 0.45); }
.brand p { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill { white-space: nowrap; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; font-weight: 600; font-size: 14px; transition: background .2s, transform .1s; }
.pill:hover { background: rgba(40, 46, 66, 0.85); }
.pill:active { transform: scale(.97); }
.pill.active { background: #fff; color: #161a26; }

.cards { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; display: flex; gap: 12px; z-index: 5; max-width: calc(100vw - 32px); overflow-x: auto; padding: 4px; scrollbar-width: none; }
.card { flex: 0 0 auto; width: 250px; text-align: left; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 10px; position: relative; overflow: hidden; transition: transform .2s, border-color .2s, box-shadow .2s; }
.card:hover { transform: translateY(-3px); }
.card.on { border-color: var(--c1); box-shadow: 0 0 0 2px var(--c1), 0 10px 30px rgba(0,0,0,.25); }
.card::before { content: ''; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--c1), var(--c2)); }
.card .row { display: flex; justify-content: space-between; align-items: baseline; }
.card .name { font-weight: 700; font-size: 17px; display: inline-flex; align-items: center; gap: 8px; }
.card .day { font-size: 12px; color: var(--muted); }
.card .pop { font-size: 30px; font-weight: 700; line-height: 1.1; margin-top: 4px; }
.card .pop small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; }
.card .up { color: #5be39a; }
.card canvas { width: 100%; height: 38px; display: block; margin-top: 6px; }

.panel { position: fixed; right: 16px; top: 92px; bottom: 210px; width: 340px; z-index: 6; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; overflow-y: auto; }
.panel-head { display: flex; gap: 12px; align-items: center; }
.panel h2 { margin: 0; font-size: 22px; }
.panel h3 { margin: 18px 0 8px; font-size: 15px; }
.swatch { width: 40px; height: 40px; border-radius: 12px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stats div { background: var(--glass-2); border-radius: 12px; padding: 8px 10px; }
.stats b { display: block; font-size: 20px; }
.stats span { font-size: 11px; color: var(--muted); }
#bigChart { width: 100%; height: 130px; background: var(--glass-2); border-radius: 12px; }
.chart-tabs { display: flex; gap: 6px; margin-top: 6px; }
.chart-tabs button { background: var(--glass-2); border: 0; border-radius: 8px; padding: 4px 10px; font-size: 12px; }
.chart-tabs button.on { background: #fff; color: #161a26; }
.log { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.log li { background: var(--glass-2); border-radius: 12px; padding: 8px 10px; font-size: 13px; }
.log li b { display: block; font-size: 14px; }
.log li .d { font-size: 11px; color: var(--muted); }
.close { position: absolute; top: 10px; right: 10px; background: var(--glass-2); border: 0; border-radius: 50%; width: 30px; height: 30px; }

.tooltip { position: fixed; z-index: 8; left: 50%; top: 90px; transform: translateX(-50%); background: #fff; color: #1c2030; border-radius: 16px; padding: 12px 16px; box-shadow: 0 12px 40px rgba(0,0,0,.25); min-width: 220px; max-width: 320px; }
.tooltip b { font-size: 17px; display: block; }
.tooltip .tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; color: #fff; margin-bottom: 4px; }
.tooltip p { margin: 4px 0 0; font-size: 13px; color: #4a5068; }

#labels { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.city-label { position: absolute; transform: translate(-50%, -100%); text-align: center; pointer-events: auto; cursor: pointer; transition: opacity .3s; }
.city-label .bubble { background: #fff; color: #1c2030; border-radius: 14px; padding: 8px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); border-bottom: 4px solid var(--c1); white-space: nowrap; }
.city-label .bubble { display: flex; align-items: center; gap: 10px; text-align: left; }
.city-label .bubble b { display: block; font-size: 18px; }
.city-label .bubble span { font-size: 13px; color: #59607a; }
.city-label::after { content: ''; display: block; width: 2px; height: 26px; margin: 0 auto; background: #fff; }

.modal { position: fixed; inset: 0; z-index: 10; background: rgba(10, 12, 20, 0.5); display: grid; place-items: center; padding: 16px; }
.modal-card { position: relative; background: #fff; color: #1c2030; border-radius: 22px; padding: 24px; max-width: 520px; width: 100%; }
.modal-card h2 { margin: 0 0 10px; }
.modal-card .close { background: #eef0f5; }
.how { padding-left: 18px; display: grid; gap: 10px; }
.how li { line-height: 1.4; }
.modal-card .muted { color: #6b7088; font-size: 14px; }

.loading { position: fixed; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; background: linear-gradient(#3f7fe0, #ffc58a); z-index: 20; transition: opacity .6s; font-size: 20px; font-weight: 600; }
.loading.done { opacity: 0; pointer-events: none; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 5px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 800px) {
  .top { padding: 10px; }
  .brand p { display: none; }
  .brand h1 .t1 { font-size: 11px; letter-spacing: 2.5px; }
  .brand h1 .t2 { font-size: 25px; }
  .brand { padding: 9px 14px; }
  .pill { padding: 7px 12px; font-size: 13px; }
  .cards { left: 0; right: 0; transform: none; max-width: none; padding: 4px 16px; bottom: 10px; }
  .card { width: 200px; padding: 10px 12px 8px; }
  .card .pop { font-size: 24px; }
  .card canvas { height: 26px; }
  .panel { left: 10px; right: 10px; width: auto; top: auto; bottom: 150px; max-height: 55vh; }
}

