:root {
  color-scheme: dark;
  --ink: #f4efe4;
  --muted: #d9d0bf;
  --gold: #e3c27a;
  --bar: #c6e38a;
  --panel: rgba(14, 32, 28, 0.86);
  --line: rgba(244, 239, 228, 0.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  line-height: 1.45;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: #14342c url("assets/pier.png") center / cover no-repeat;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(20, 36, 30, 0.12), rgba(10, 22, 18, 0.28));
}

body[data-phase="night"]::after {
  background: rgba(7, 14, 28, 0.48);
}

body.is-biting .shell {
  animation: shake 0.12s linear infinite;
}

body.is-fight {
  touch-action: none;
  user-select: none;
}

img {
  user-select: none;
  -webkit-user-drag: none;
}

button, input { font: inherit; }

button {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  background: var(--gold);
  color: #1d2416;
  font-weight: 700;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
}

button:disabled { opacity: 0.55; cursor: default; }

button:focus-visible,
input:focus-visible,
.spot:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.shell {
  width: min(460px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.top, .panel {
  background: var(--panel);
  border-radius: 16px;
}

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 14px;
}

.top h1, .who, .sky { margin: 0; }

.top h1 { font-size: 1.3rem; letter-spacing: 0.04em; }

.who { color: var(--muted); }

.sky {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(227, 194, 122, 0.18);
  color: var(--gold);
  font-size: 0.92rem;
}

.panel { padding: 16px; }

h2 { margin: 0 0 6px; font-size: 1.35rem; }

.lead { margin: 0 0 12px; color: var(--muted); }

.kicker {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}

.note { min-height: 1.4em; color: var(--gold); }

form { display: grid; gap: 8px; }

label { font-size: 0.92rem; }

input {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  font-size: 16px;
  padding: 0 12px;
}

.warn { min-height: 1.2em; margin: 8px 0 0; color: #f0b2a4; }

.spots { display: grid; gap: 8px; margin-bottom: 12px; }

.spot {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  font-weight: 600;
}

.spot span { color: var(--muted); font-weight: 500; font-size: 0.92rem; }

.spot.on {
  border-color: var(--gold);
  background: rgba(227, 194, 122, 0.16);
}

#cast, #open-dex, #cancel { width: 100%; }

#open-dex, #cancel { margin-top: 8px; }

.wait { text-align: center; }

.bobber {
  width: 2px;
  height: 72px;
  margin: 8px auto 14px;
  background: rgba(244, 239, 228, 0.45);
  position: relative;
}

.bobber span {
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 35% 35%, #fff, #e3c27a 40%, #9a4a3a);
}

.meter {
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.38);
  margin-bottom: 14px;
}

.meter span {
  display: block;
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, var(--gold), var(--bar));
}

.fight-layout {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.fight-layout > div:first-child { flex: 1; min-width: 0; }

.gauge {
  position: relative;
  width: 84px;
  height: 58vh;
  min-height: 280px;
  flex: none;
  border-radius: 18px;
  border: 2px solid var(--line);
  background: rgba(6, 18, 16, 0.72);
  overflow: hidden;
}

.gauge-bar {
  position: absolute;
  left: 7px;
  right: 7px;
  border-radius: 10px;
  background: var(--bar);
}

.gauge.holding .gauge-bar { background: #ddf3b0; }

.gauge-fish {
  position: absolute;
  left: 50%;
  width: 74px;
  height: 46px;
  object-fit: contain;
  transform: translate(-50%, 50%);
  pointer-events: none;
}

.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.row button { flex: 1; }

.row.spread { align-items: center; margin-top: 0; }

.row.spread h2 { margin: 0; }

.row.spread button { flex: 0 0 auto; }

.catch-art {
  display: block;
  width: min(100%, 320px);
  aspect-ratio: 1;
  object-fit: contain;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: #14342c;
}

.size {
  margin: 0 0 6px;
  text-align: center;
  color: var(--gold);
  font-size: 1.5rem;
}

#result-card h2, .miss { text-align: center; }

.miss { margin: 18px 0 8px; font-size: 1.4rem; }

#result-card .lead { text-align: center; }

.dex-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.dex-card {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #14342c;
}

.dex-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #14342c;
}

.dex-card p {
  margin: 0;
  padding: 0 4px 8px;
  text-align: center;
  font-size: 0.82rem;
}

.dex-card .meta { color: var(--gold); padding-top: 0; }

.dex-card.unknown img {
  filter: brightness(0);
  opacity: 0.5;
}

.toast {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(14, 32, 28, 0.92);
  color: #f0b2a4;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@media (max-width: 380px) {
  .gauge { width: 72px; min-height: 240px; }
  .dex-grid { gap: 6px; }
}
