@font-face {
  font-family: 'Fishing Sans';
  src: url('./assets/game-sans.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 750;
  font-display: swap;
}

@font-face {
  font-family: 'Nanum Myeongjo';
  src: url('./assets/game-serif.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: 'Fishing Sans', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  color: #f0ece3;
  background: #10191c;
  --muted: #aab7b7;
  --amber: #f2bd83;
  --line: #2d3b3d;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; min-height: 100vh; }
button { font: inherit; }
button:enabled { cursor: pointer; }
button:focus-visible { outline: 2px solid #fff3d4; outline-offset: 4px; }
[hidden] { display: none !important; }

.shell { width: min(100% - 96px, 1280px); margin-inline: auto; }
.masthead { background: #10181b; border-bottom: 1px solid #263235; }
.masthead-inner { min-height: 65px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 1.13rem; font-weight: 720; letter-spacing: .025em; }
.brand-icon { position: relative; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--amber); background: #332a25; border: 1px solid #644c38; }
.brand-icon i { position: relative; width: 11px; height: 15px; border: 1.5px solid currentColor; border-top: 0; border-left-color: transparent; border-radius: 0 0 8px 8px; transform: translateY(-1px) rotate(25deg); }
.brand-icon i::before { content: ''; position: absolute; top: -2px; right: -3px; width: 4px; height: 4px; border: 1.3px solid currentColor; border-radius: 50%; }
.brand-icon i::after { content: ''; position: absolute; bottom: 4px; left: -1px; width: 5px; height: 5px; border-top: 1.3px solid currentColor; border-left: 1.3px solid currentColor; transform: rotate(31deg); }

.sound-button { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px; border: 1px solid #344244; border-radius: 8px; color: #cdd3cf; background: #192326; font-size: .82rem; }
.sound-button:hover { background: #223034; }
.sound-button[aria-pressed='true'] { color: var(--amber); }
.sound-icon { position: relative; display: inline-block; width: 17px; height: 17px; }
.sound-icon::before { content: ''; position: absolute; inset: 2px 6px 2px 1px; background: currentColor; clip-path: polygon(0 30%, 34% 30%, 100% 0, 100% 100%, 34% 70%, 0 70%); }
.sound-icon i { position: absolute; right: 2px; top: 4px; height: 9px; width: 4px; border-right: 1.5px solid currentColor; border-radius: 50%; }
.sound-button[aria-pressed='false'] .sound-icon i { border: 0; right: 2px; top: 4px; width: 1.5px; height: 10px; background: currentColor; transform: rotate(44deg); }

main.shell { padding-block: 33px 34px; }
.game-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.game-heading h1 { margin: 0; font-family: 'Nanum Myeongjo', 'Batang', Georgia, serif; font-size: clamp(2.05rem, 4vw, 3.15rem); font-weight: 700; line-height: 1.19; letter-spacing: -.045em; }
.game-heading p { margin: 9px 0 0; color: var(--muted); font-size: .91rem; line-height: 1.6; word-break: keep-all; }
.score { display: flex; align-items: center; gap: 11px; min-width: 107px; padding: 9px 13px 9px 12px; background: #182326; border: 1px solid #303e40; border-radius: 10px; color: var(--amber); }
.score-label, .score-value { display: block; white-space: nowrap; }
.score-label { margin-bottom: 1px; color: var(--muted); font-size: .68rem; }
.score-value { color: #d9d9d0; font-size: .72rem; }
.score-value strong { color: #f6e6cf; font-size: 1.12rem; font-variant-numeric: tabular-nums; }
.fish-icon { position: relative; width: 22px; height: 13px; flex: 0 0 auto; }
.fish-icon::before { content: ''; position: absolute; inset: 1px 6px 1px 0; border-radius: 70% 57% 57% 70%; background: currentColor; }
.fish-icon::after { content: ''; position: absolute; top: 1px; right: 0; border: solid transparent; border-width: 5px 6px 5px 0; border-right-color: currentColor; }

.game { overflow: hidden; border: 1px solid #3e4a49; border-radius: 14px; background: #182326; box-shadow: 0 18px 60px #050a0a4f; }
.scene { position: relative; isolation: isolate; height: clamp(365px, 64vh, 675px); overflow: hidden; background: #172a31 url('./assets/coast.webp') 45% 51% / cover no-repeat; }
#sea, .scene-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
#sea { display: block; opacity: 0; }
.game[data-rendered='true'] #sea { opacity: 1; }
.scene-shade { pointer-events: none; background: linear-gradient(180deg, #080e1960, transparent 22%, transparent 80%, #080f1836); }
.scene-tools { position: absolute; inset: 16px 17px auto; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.phase, .fullscreen-button { display: inline-flex; align-items: center; background: #0c151de3; color: #f1e8d9; border: 1px solid #eee8d344; }
.phase { gap: 8px; min-height: 35px; padding: 0 11px; border-radius: 7px; font-size: .79rem; font-weight: 590; }
.phase i { width: 6px; height: 6px; border-radius: 50%; background: #d2a979; box-shadow: 0 0 10px #f2bd835c; }
.fullscreen-button { pointer-events: auto; justify-content: center; width: 38px; height: 36px; border-radius: 7px; }
.fullscreen-button:hover { background: #222e38; }
.fullscreen-icon { position: relative; width: 15px; height: 15px; }
.fullscreen-icon::before, .fullscreen-icon::after { content: ''; position: absolute; inset: 0; border: 1.5px solid currentColor; }
.fullscreen-icon::before { clip-path: polygon(0 0, 38% 0, 38% 38%, 0 38%, 0 0, 100% 100%, 62% 100%, 62% 62%, 100% 62%, 100% 100%); }
.fullscreen-icon::after { transform: rotate(90deg); clip-path: polygon(0 0, 38% 0, 38% 38%, 0 38%, 0 0, 100% 100%, 62% 100%, 62% 62%, 100% 62%, 100% 100%); }
.fullscreen-button[aria-pressed='true'] .fullscreen-icon::before,
.fullscreen-button[aria-pressed='true'] .fullscreen-icon::after { inset: 3px; }

.target { display: none; position: absolute; left: 51%; top: 63%; width: 36px; height: 27px; border: 1px solid #fff2d7aa; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 13px #14202877, inset 0 0 13px #14202855; }
.target::after { content: ''; position: absolute; inset: 50% auto auto 50%; width: 4px; height: 4px; border-radius: 50%; background: #fff2d7; transform: translate(-50%, -50%); }
[data-phase='ready'] .target { display: block; }

.bite { display: none; position: absolute; left: 51%; top: 63%; transform: translate(-50%, calc(-100% - 23px)); min-width: 103px; color: #2d1c11; text-align: center; background: #ffd497; padding: 7px 12px 6px; border: 1px solid #ffe8bb; border-radius: 7px; box-shadow: 0 3px 24px #ffc58250; pointer-events: none; font-weight: 750; font-size: .86rem; }
[data-phase='bite'] .bite { display: block; }
[data-phase='bite'] .phase { background: #372414f0; border-color: #e5a86899; }
[data-phase='bite'] .phase i { background: #ffd590; box-shadow: 0 0 11px #ffb569bd; }
.bite-timer { height: 2px; margin-top: 4px; overflow: hidden; border-radius: 10px; background: #50361935; }
.bite-timer i { display: block; width: 100%; height: 100%; background: #503619; transform-origin: left; }

.catch { position: absolute; top: 47%; left: 50%; width: min(348px, 76%); transform: translate(-50%, -50%); padding: 19px 22px 16px; border-radius: 12px; border: 1px solid #c59666a3; background: linear-gradient(155deg, #222c30f7, #111a20f7); box-shadow: 0 16px 70px #02070b99; animation: reveal 280ms ease-out both; }
.catch img { display: block; width: 100%; height: auto; max-height: 155px; object-fit: contain; filter: drop-shadow(0 7px 10px #060c1080); }
.catch-details { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-top: 13px; padding-top: 11px; border-top: 1px solid #faf0d72d; }
.catch-details h2 { margin: 0; font-family: 'Nanum Myeongjo', 'Batang', Georgia, serif; font-size: 1.62rem; color: #fff2d7; }
.catch-details span { color: #efc18e; font-size: .82rem; white-space: nowrap; }
.catch-details strong { font-size: 1.12rem; font-variant-numeric: tabular-nums; }
@keyframes reveal { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }

.controls { display: flex; align-items: center; justify-content: space-between; gap: 19px; padding: 15px 19px; border-top: 1px solid #ffffff1d; }
.status { display: flex; align-items: center; gap: 13px; min-width: 0; }
.status-icon { flex: 0 0 auto; position: relative; display: grid; place-items: center; width: 39px; height: 39px; color: var(--amber); border: 1px solid #6e553e; background: #3a3028; border-radius: 9px; }
.status-icon i { position: relative; width: 8px; height: 12px; border: 1.4px solid currentColor; border-radius: 70%; transform: rotate(-24deg); }
.status-icon i::before { content: ''; position: absolute; top: -5px; left: 2px; width: 1.5px; height: 6px; border-radius: 2px; background: currentColor; }
.status-icon i::after { content: ''; position: absolute; left: -6px; bottom: -5px; width: 18px; height: 5px; border: 1px solid currentColor; border-top-color: transparent; border-radius: 50%; transform: rotate(24deg); opacity: .64; }
.status h2 { margin: 0 0 3px; font-size: .96rem; font-weight: 710; line-height: 1.4; }
.status p { margin: 0; color: var(--muted); font-size: .79rem; line-height: 1.47; word-break: keep-all; }

.action { display: flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 15px; min-width: 160px; min-height: 47px; padding: 0 13px 0 16px; color: #241a14; background: var(--amber); border: 1px solid #ffdbac; border-radius: 8px; box-shadow: 0 2px 7px #0004; font-size: .91rem; font-weight: 750; transition: background-color 120ms ease; }
.action:hover:enabled { background: #ffcf9d; }
.action:active:enabled { background: #e4ac75; }
.action:disabled { color: #aeb7b6; background: #2b383b; border-color: #435052; box-shadow: none; }
.action kbd { border: 1px solid #65452544; border-radius: 4px; padding: 3px 5px; color: #55381f; background: #fff1d44d; font: 650 .65rem/1.1 'Fishing Sans', system-ui, sans-serif; }
.action:disabled kbd { visibility: hidden; }
[data-phase='waiting'] .action { background: #b89b7b; border-color: #d2b797; }
[data-phase='bite'] .action { background: #ffd79b; border-color: #ffebbc; box-shadow: 0 0 21px #ffc58966; }

.game:fullscreen { display: flex; flex-direction: column; border: 0; border-radius: 0; }
.game:fullscreen .scene { flex: 1 1 auto; min-height: 0; height: auto; }
.game:fullscreen .controls { flex: 0 0 auto; }

@media (max-width: 800px) {
  .shell { width: calc(100% - 40px); }
  main.shell { padding-block: 26px; }
  .scene { height: clamp(340px, 60svh, 560px); }
}

@media (max-width: 540px) {
  .shell { width: calc(100% - 28px); }
  .masthead-inner { min-height: 56px; }
  main.shell { padding-block: 22px; }
  .game-heading { gap: 11px; margin-bottom: 15px; }
  .game-heading h1 { font-size: clamp(1.55rem, 6.35vw, 2.05rem); }
  .game-heading p { font-size: .77rem; margin-top: 7px; }
  .score { padding: 6px 9px; min-width: 0; gap: 6px; }
  .score .fish-icon { width: 18px; }
  .score-value strong { font-size: 1rem; }
  .game { border-radius: 11px; }
  .scene { height: clamp(290px, 55svh, 535px); background-image: url('./assets/coast-portrait.webp'); }
  .scene-tools { inset: 11px 11px auto; }
  .controls { padding: 11px 10px; gap: 9px; }
  .status { gap: 7px; }
  .status-icon { display: none; }
  .status h2 { font-size: .85rem; }
  .status p { font-size: .71rem; }
  .action { min-width: 89px; min-height: 45px; padding: 0 9px; font-size: .78rem; }
  .action kbd { display: none; }
}

@media (max-height: 600px) and (orientation: landscape) {
  .masthead-inner { min-height: 48px; }
  main.shell { padding-block: 13px; }
  .game-heading { margin-bottom: 11px; }
  .game-heading h1 { font-size: 1.6rem; }
  .game-heading p { display: none; }
  .score { padding-block: 4px; }
  .scene { height: max(168px, calc(100svh - 195px)); }
  .controls { padding-block: 8px; }
  .catch { display: grid; grid-template-columns: 1.25fr 1fr; align-items: center; gap: 12px; padding: 10px 15px; }
  .catch img { max-height: 90px; }
  .catch-details { display: block; margin-top: 0; padding: 0 0 0 12px; border-top: 0; border-left: 1px solid #faf0d72d; }
  .catch-details h2 { margin-bottom: 4px; }
}

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