@font-face { font-family: 'Atkinson'; src: url(../public/fonts/atkinson-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url(../public/fonts/atkinson-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url(../public/fonts/fraunces-800.woff2) format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --ink: #1d2a33; --ink2: #44535d; --ice: #eef4f7; --ice2: #d4e5ed; --teal: #0e5458; --deep: #05222a;
  --accent: #e4572e; --accent-d: #b9401d; --gold: #f2c14e; --moss: #5fb37a;
  --panel: rgba(247, 251, 253, 0.86); --panel-b: rgba(29, 42, 51, 0.08);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--teal); color: var(--ink); }
body { font: 400 15px/1.4 'Atkinson', 'Segoe UI', sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 800; letter-spacing: -0.01em; margin: 0; }

/* --- yläpalkki --- */
.top {
  position: fixed; left: 0; right: 0; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r)) 8px calc(10px + var(--safe-l)); pointer-events: none;
}
.top > * { pointer-events: auto; }
.back, .brand, .stat, .tools { background: var(--panel); border: 1px solid var(--panel-b); border-radius: 14px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.back { color: var(--ink); text-decoration: none; font-weight: 700; padding: 8px 11px; font-size: 14px; white-space: nowrap; }
.back:hover { color: var(--accent-d); }
.brand { display: flex; align-items: center; gap: 7px; padding: 4px 12px 4px 6px; }
.brand span { font: 800 21px/1 'Fraunces', serif; color: var(--teal); letter-spacing: -0.02em; }
.stat { display: flex; flex-direction: column; align-items: flex-start; padding: 4px 12px; min-width: 72px; }
.stat b { font-size: 19px; font-variant-numeric: tabular-nums; line-height: 1.15; white-space: nowrap; }
.stat small { font-size: 11px; color: var(--ink2); line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.catch b { color: var(--accent-d); }
.clock.urgent b { color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.45; } }
.tools { margin-left: auto; display: flex; padding: 3px; gap: 2px; }
.icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; color: var(--ink); }
.icon:hover { background: rgba(29, 42, 51, 0.07); }
#bSound .i-off, #bSound.off .i-on { display: none; }
#bSound.off .i-off { display: block; }

/* --- tulostaulu --- */
.board {
  position: fixed; right: calc(10px + var(--safe-r)); top: calc(66px + var(--safe-t)); z-index: 9; display: flex; flex-direction: column; gap: 4px;
  pointer-events: none; min-width: 150px;
}
.row { display: flex; align-items: center; gap: 7px; background: var(--panel); border-radius: 10px; padding: 4px 10px 4px 6px; font-size: 13px; transition: transform .3s; border: 1px solid var(--panel-b); }
.row .pos { width: 16px; font-weight: 700; color: var(--ink2); text-align: right; }
.row .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.row .nm { flex: 1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .kg { font-variant-numeric: tabular-nums; font-weight: 700; }
.row.you { background: var(--accent); color: #fff; border-color: transparent; }
.row.you .pos { color: rgba(255, 255, 255, 0.8); }
.row.flash { animation: rowflash .7s; }
@keyframes rowflash { 30% { transform: translateX(-8px); } }

.lakeinfo {
  position: fixed; left: calc(10px + var(--safe-l)); top: calc(66px + var(--safe-t)); z-index: 9; background: var(--panel);
  border-radius: 12px; padding: 6px 12px; pointer-events: none; max-width: 60vw; border: 1px solid var(--panel-b);
}
.lakeinfo b { display: block; font: 800 17px/1.2 'Fraunces', serif; color: var(--teal); }
.lakeinfo span { font-size: 12px; color: var(--ink2); }
.hole-view .lakeinfo, .hole-view .board { opacity: 0.88; }
.hole-view .lakeinfo { display: none; }

.hint {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(118px + var(--safe-b)); z-index: 8; pointer-events: none;
  background: rgba(29, 42, 51, 0.72); color: #fff; border-radius: 99px; padding: 6px 14px; font-size: 13px; white-space: nowrap;
  width: max-content; max-width: calc(100vw - 20px); overflow: hidden; text-overflow: ellipsis; transition: opacity .4s;
}
.hint:empty { display: none; }

/* --- pop-tekstit --- */
.pops { position: fixed; left: 0; right: 0; top: 34%; z-index: 20; pointer-events: none; display: flex; flex-direction: column; align-items: center; }
.pop {
  font: 800 30px/1.1 'Fraunces', serif; color: #fff; text-align: center; padding: 0 12px;
  text-shadow: 0 2px 0 rgba(5, 34, 42, 0.6), 0 0 18px rgba(5, 34, 42, 0.55); animation: pop 1.3s ease-out forwards;
}
.pop.big { font-size: clamp(44px, 9vw, 86px); color: var(--gold); letter-spacing: 0.02em; animation-duration: .9s; }
.pop.good { color: #b8f0c8; }
.pop.bad { color: #ffb39c; font-size: 24px; }
.pop.info { font-size: 22px; }
@keyframes pop {
  0% { transform: scale(0.6) translateY(8px); opacity: 0; }
  15% { transform: scale(1.08); opacity: 1; }
  30% { transform: scale(1); }
  75% { opacity: 1; }
  100% { transform: translateY(-34px); opacity: 0; }
}

.toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(66px + var(--safe-t)); z-index: 11; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.toast { background: rgba(29, 42, 51, 0.82); color: #fff; padding: 5px 12px; border-radius: 99px; font-size: 13px; animation: toast 3.6s forwards; white-space: nowrap; }
.toast i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-6px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

.banner {
  position: fixed; left: 50%; transform: translateX(-50%); top: calc(118px + var(--safe-t)); z-index: 9; background: var(--gold); color: var(--ink);
  border-radius: 12px; padding: 7px 14px; font-weight: 700; font-size: 14px; max-width: calc(100vw - 24px); text-align: center; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

/* --- toimintopalkki --- */
.actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; gap: 14px;
  padding: 8px calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l)); pointer-events: none;
}
.actions > * { pointer-events: auto; }
.lures { display: flex; gap: 6px; background: var(--panel); padding: 5px; border-radius: 16px; border: 1px solid var(--panel-b); }
.lures button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 6px 4px; border-radius: 11px; min-width: 58px; font-size: 11px; font-weight: 700; color: var(--ink2); }
.lures button svg { width: 26px; height: 26px; stroke: #4a555c; stroke-width: 1.4; }
.lures button.on { background: var(--teal); color: #fff; }
.lures button.on svg { stroke: #fff; }
.main-btn {
  position: relative; width: 96px; height: 96px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; box-shadow: 0 6px 0 var(--accent-d), 0 10px 24px rgba(0, 0, 0, 0.25); transition: transform .06s, box-shadow .06s; touch-action: none;
}
.main-btn .lbl { font: 800 16px/1.05 'Fraunces', serif; text-align: center; padding: 0 6px; position: relative; }
.main-btn .sub { font-size: 10px; opacity: 0.85; position: relative; font-weight: 700; }
.main-btn .ring { position: absolute; inset: -6px; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--p, 0) * 1turn), transparent 0); -webkit-mask: radial-gradient(circle, transparent 52px, #000 53px); mask: radial-gradient(circle, transparent 52px, #000 53px); }
.main-btn.down, .main-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--accent-d), 0 4px 10px rgba(0, 0, 0, 0.25); }
.main-btn.reel { background: var(--teal); box-shadow: 0 6px 0 #073135, 0 10px 24px rgba(0, 0, 0, 0.25); }
.main-btn.hot { animation: hot .25s infinite alternate; }
@keyframes hot { to { box-shadow: 0 6px 0 var(--accent-d), 0 0 0 10px rgba(242, 193, 78, 0.55); } }
.main-btn.dim { filter: saturate(0.4) brightness(0.9); }
.side-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--panel); border-radius: 16px; padding: 8px 12px; font-size: 12px; font-weight: 700; border: 1px solid var(--panel-b); min-width: 66px; }
.side-btn:disabled { opacity: 0.4; }
.map-view #bMap { visibility: hidden; }

/* --- saalis-kortti --- */
.card {
  position: fixed; left: 50%; top: calc(76px + var(--safe-t)); transform: translateX(-50%); z-index: 15; background: #fbfdfe; border-radius: 20px;
  padding: 10px 18px 14px; box-shadow: 0 16px 40px rgba(5, 34, 42, 0.35); display: flex; align-items: center; gap: 12px; animation: cardIn .35s cubic-bezier(.3, 1.5, .5, 1);
  max-width: calc(100vw - 20px); cursor: pointer;
}
.card canvas { width: 200px; height: 88px; flex: none; }
.card h3 { font-size: 24px; color: var(--teal); }
.card p { margin: 0; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .note { font-size: 14px; color: var(--accent-d); font-weight: 700; min-height: 0; }
.card.rec { box-shadow: 0 0 0 4px var(--gold), 0 16px 40px rgba(5, 34, 42, 0.35); }
@keyframes cardIn { from { transform: translateX(-50%) translateY(-30px) scale(0.85); opacity: 0; } }

/* --- modaalit --- */
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(5, 34, 42, 0.55); display: grid; place-items: center; padding: 12px; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet {
  width: min(600px, 100%); max-height: calc(100dvh - 24px); overflow: auto; background: var(--ice); border-radius: 22px; padding: 22px 22px 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); user-select: text; -webkit-user-select: text; position: relative;
}
.sheet h2 { font-size: 30px; color: var(--teal); line-height: 1.05; }
.sheet .sub { color: var(--ink2); margin: 4px 0 14px; }
.sheet .x { position: absolute; right: 12px; top: 12px; }
.hero { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.hero img { width: 64px; height: 64px; transform: rotate(-6deg); }
.modes { display: grid; grid-template-columns: 1.35fr 1fr; grid-template-rows: auto auto; gap: 10px; margin-bottom: 14px; }
.mode { text-align: left; border-radius: 16px; padding: 14px; background: #fff; border: 2px solid transparent; box-shadow: 0 2px 0 rgba(29, 42, 51, 0.08); transition: transform .1s; }
.mode:hover { transform: translateY(-2px); border-color: var(--ice2); }
.mode b { display: block; font: 800 20px/1.1 'Fraunces', serif; }
.mode span { font-size: 13px; color: var(--ink2); }
.mode.primary { grid-row: span 2; background: var(--teal); color: #fff; display: flex; flex-direction: column; justify-content: flex-end; min-height: 150px; position: relative; overflow: hidden; }
.mode.primary span { color: rgba(255, 255, 255, 0.8); }
.mode.primary::before { content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, #2b8a8a 0 38%, #0a3b40 39% 60%, transparent 61%); }
.mode.daily { background: var(--gold); }
.mode.daily span { color: #5b4a17; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 12px; background: #fff; font-weight: 700; box-shadow: 0 2px 0 rgba(29, 42, 51, 0.1); }
.btn:hover { background: #f6fafc; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 3px 0 var(--accent-d); }
.btn.teal { background: var(--teal); color: #fff; box-shadow: 0 3px 0 #073135; }
.btn svg { width: 18px; height: 18px; }
.sheet table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
.sheet th { text-align: left; font-size: 12px; color: var(--ink2); font-weight: 700; padding: 4px 6px; border-bottom: 1px solid var(--ice2); }
.sheet td { padding: 6px; border-bottom: 1px solid rgba(29, 42, 51, 0.06); }
.sheet td.r, .sheet th.r { text-align: right; }
.sheet tr.you td { font-weight: 700; color: var(--accent-d); }
.sheet .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 8px 0 14px; }
.stats div { background: #fff; border-radius: 12px; padding: 8px 10px; }
.stats b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--ink2); }
.place { font: 800 54px/1 'Fraunces', serif; color: var(--accent); }
.endhead { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 8px; }
.catchgrid { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 14px; }
.catchgrid span { background: #fff; border-radius: 8px; padding: 3px 8px; font-size: 13px; }
.help p { margin: 0 0 10px; }
.result-banner { background: var(--gold); padding: 8px 12px; border-radius: 12px; font-weight: 700; margin-bottom: 10px; }
.nickrow { display: flex; gap: 8px; margin-top: 10px; }
.nickrow input { flex: 1; font: inherit; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--ice2); min-width: 0; }
.small { font-size: 12px; color: var(--ink2); margin-top: 12px; }
.small a { color: var(--ink2); }

.embed-link { position: fixed; right: 8px; bottom: 6px; z-index: 40; font: 700 12px 'Atkinson', sans-serif; color: #fff; background: rgba(5, 34, 42, 0.6); padding: 3px 8px; border-radius: 8px; text-decoration: none; }
.embed .back, .embed #bMenu, .embed .brand { display: none; }
.embed .actions { padding-bottom: calc(26px + var(--safe-b)); }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; color: #fff; }

/* --- pienet näytöt --- */
@media (max-width: 640px) {
  .brand span { display: none; }
  .brand { padding: 4px; }
  .stat { min-width: 0; padding: 4px 9px; }
  .stat b { font-size: 16px; }
  .back { padding: 8px 8px; font-size: 13px; }
  .icon { width: 36px; height: 36px; }
  .board { min-width: 0; top: calc(60px + var(--safe-t)); }
  .row { font-size: 12px; padding: 3px 8px 3px 5px; }
  .row .nm { max-width: 58px; }
  .lakeinfo { top: calc(60px + var(--safe-t)); max-width: 52vw; }
  .lakeinfo b { font-size: 15px; }
  .actions { gap: 8px; justify-content: space-between; }
  .lures button { min-width: 46px; padding: 4px 3px; font-size: 10px; }
  .lures button svg { width: 22px; height: 22px; }
  .main-btn { width: 84px; height: 84px; }
  .main-btn .ring { -webkit-mask: radial-gradient(circle, transparent 46px, #000 47px); mask: radial-gradient(circle, transparent 46px, #000 47px); }
  .hint { bottom: calc(108px + var(--safe-b)); font-size: 12px; }
  .card { padding: 8px 12px 10px; gap: 8px; }
  .card canvas { width: 130px; height: 57px; }
  .card h3 { font-size: 19px; }
  .card p { font-size: 18px; }
  .modes { grid-template-columns: 1fr 1fr; }
  .mode.primary { grid-column: span 2; grid-row: auto; min-height: 110px; }
  .sheet { padding: 18px 16px 14px; }
  .sheet h2 { font-size: 25px; }
}
@media (max-width: 480px) {
  .catch small { display: none; }
  .stat { justify-content: center; }
}
@media (max-height: 520px) {
  .hint { display: none; }
  .lakeinfo span { display: none; }
  .main-btn { width: 72px; height: 72px; }
  .main-btn .lbl { font-size: 14px; }
  .main-btn .ring { -webkit-mask: radial-gradient(circle, transparent 40px, #000 41px); mask: radial-gradient(circle, transparent 40px, #000 41px); }
  .lures button { padding: 3px 4px; }
  .board { gap: 2px; }
  .row { padding: 2px 8px 2px 5px; }
}
@media (max-width: 380px) {
  .catch small, .clock small { display: none; }
  .lures button span { display: none; }
}
@media (min-width: 1600px) {
  body { font-size: 17px; }
  .stat b { font-size: 22px; }
  .main-btn { width: 108px; height: 108px; }
  .main-btn .ring { -webkit-mask: radial-gradient(circle, transparent 58px, #000 59px); mask: radial-gradient(circle, transparent 58px, #000 59px); }
}
@media (prefers-reduced-motion: reduce) {
  .pop, .toast, .card { animation-duration: .01s !important; }
}
