/* Layout: sun-bleached sand panels floating on lagoon water; the island map is the hero, everything else docks beneath it.
   Single committed daytime look (no dark variant): a bright tropical world reads the same on any host. */
:root {
    --ocean: #0a3d5c;
    --ocean-2: #0f5878;
    --lagoon: #1fb5b8;
    --lagoon-lt: #a6ebe3;
    --sand: #fdf7e8;
    --sand-2: #f4e6c4;
    --sand-line: #e2cd9b;
    --palm: #2e8b57;
    --coral: #ff6b57;
    --coral-dk: #d94731;
    --sun: #ffc23d;
    --ink: #173447;
    --ink-soft: #4e6676;
    --white: #ffffff;
    --good: #23824e;
    --bad: #c93b26;

    --font-display: 'Lilita One', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif;
    --font-body: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, -apple-system, sans-serif;

    --r-lg: 22px;
    --r-md: 14px;
    --r-sm: 10px;
    --shadow: 0 5px 0 var(--sand-line), 0 14px 30px rgba(5, 40, 60, 0.18);
    --gutter-l: max(16px, env(safe-area-inset-left, 0px));
    --gutter-r: max(16px, env(safe-area-inset-right, 0px));

    color-scheme: light;
}

/* ───────── Tones: one strong + one pale colour per creature family ───────── */
.tone-lagoon { --t: #11898d; --t-bg: #d3f3ef; }
.tone-palm   { --t: #23824e; --t-bg: #dcf1e2; }
.tone-coral  { --t: #d94731; --t-bg: #ffe2db; }
.tone-sun    { --t: #a86f00; --t-bg: #fff0c4; }
.tone-sky    { --t: #2468a8; --t-bg: #dcebfa; }
.tone-shell  { --t: #5b6b78; --t-bg: #e7ecef; }
.tone-orchid { --t: #8b3fa8; --t-bg: #f2e1f7; }
.tone-bark   { --t: #8a5526; --t-bg: #f3e3d0; }
.tone-sand   { --t: #94661c; --t-bg: #f8ead0; }

/* ───────── Base ───────── */
html { min-height: 100%; background: var(--ocean); }
body {
    min-height: 100%;
    margin: 0;
    color: var(--ink);
    background: var(--ocean) linear-gradient(180deg, #23b9bb 0, #128fa3 340px, var(--ocean-2) 820px, var(--ocean) 1300px) no-repeat;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}
body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    height: env(safe-area-inset-top, 0px);
    z-index: 60;
    background: var(--ocean);
}
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 8px; }

.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; }
.star { color: #cdbf9a; }
.star.is-on { color: var(--sun); fill: var(--sun); stroke: #c98d00; }

.display { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.8rem, 1.3rem + 2.2vw, 2.8rem); line-height: 1.05; letter-spacing: 0.005em; }
.display-sm { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.3rem, 1.1rem + 0.9vw, 1.7rem); line-height: 1.15; }
.eyebrow { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--lagoon); }
.muted { color: var(--ink-soft); }
.section-title { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; margin-block: 8px 2px; }
.is-bad { color: var(--bad); }
.is-good { color: var(--good); }

.panel {
    background: var(--sand);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
}

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row.is-center { justify-content: center; }

/* ───────── Buttons ───────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 16px;
    border: 0;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-lg { min-height: 52px; padding: 10px 22px; font-size: 1.05rem; }
.btn-coral { background: var(--coral); color: var(--white); box-shadow: 0 4px 0 var(--coral-dk); }
.btn-coral:hover:not(:disabled) { background: #ff7d6b; }
.btn-coral:active:not(:disabled) { box-shadow: 0 2px 0 var(--coral-dk); }
.btn-sand { background: var(--sand-2); color: var(--ink); box-shadow: 0 4px 0 var(--sand-line); }
.btn-sand:hover { background: #f8ecd0; }
.btn-ghost { background: rgba(255, 255, 255, 0.55); color: var(--ink); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.85); }
.btn-danger { background: #fde3de; color: var(--bad); }
.link { background: none; border: 0; padding: 0; color: var(--ocean-2); font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ───────── Top bar ───────── */
.topbar {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 50;
    background: var(--ocean);
    color: var(--white);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}
.topbar-inner {
    max-width: 1160px;
    margin: 0 auto;
    padding-block: 10px;
    padding-left: var(--gutter-l);
    padding-right: var(--gutter-r);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; text-align: left; padding: 0; min-width: 0; }
.brand-mark {
    display: grid; place-items: center;
    width: 44px; height: 44px; flex: none;
    border-radius: 14px;
    background: var(--lagoon);
    font-size: 1.6rem;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.15);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text b { font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; color: var(--sun); white-space: nowrap; }
.brand-text small { font-size: 0.75rem; color: var(--lagoon-lt); }
.topbar-tools { display: flex; align-items: center; gap: 6px; }
.stat, .icon-btn {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 40px; min-width: 40px; padding: 6px 12px;
    border: 0; border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--white);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    justify-content: center;
}
.icon-btn { padding: 6px; }
.stat:hover, .icon-btn:hover { background: rgba(255, 255, 255, 0.22); }

.app {
    max-width: 1160px;
    margin: 0 auto;
    padding-block: 20px 120px;
    padding-left: var(--gutter-l);
    padding-right: var(--gutter-r);
}

/* ───────── Zone chips ───────── */
.zone-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}
.zone-lagoon { --z: #11898d; --z-bg: #d3f3ef; }
.zone-beach  { --z: #94661c; --z-bg: #f8ead0; }
.zone-jungle { --z: #23824e; --z-bg: #dcf1e2; }
.zone-chip { background: var(--z-bg); color: var(--z); }

/* ───────── Stars ───────── */
.stars { display: inline-flex; gap: 2px; }
.stars .ico { width: 18px; height: 18px; }

/* ───────── Sippy ───────── */
.sippy {
    position: fixed;
    z-index: 70;
    right: calc(12px + env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: min(400px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    animation: sippy-in 0.3s ease-out;
}
.sippy-card {
    position: relative;
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 40px 12px 12px;
    background: var(--sand);
    border: 3px solid var(--lagoon);
    border-radius: var(--r-lg);
    box-shadow: 0 12px 30px rgba(5, 40, 60, 0.35);
}
.sippy-avatar {
    position: relative;
    display: grid; place-items: center;
    width: 56px; height: 56px; flex: none;
    border-radius: 18px;
    background: var(--lagoon-lt);
    font-size: 2.1rem;
}
.sippy-mood { position: absolute; top: -10px; right: -10px; font-size: 1.2rem; }
.sippy-name { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); color: var(--lagoon); font-size: 1.05rem; }
.sippy-listen {
    display: inline-flex; align-items: center; gap: 4px;
    border: 0; border-radius: 999px; padding: 2px 10px;
    background: var(--sand-2); color: var(--ink-soft);
    font-family: var(--font-body); font-size: 0.75rem; font-weight: 700; cursor: pointer;
}
.sippy-text { font-size: 0.95rem; line-height: 1.4; }
.sippy-close {
    position: absolute; top: 6px; right: 6px;
    display: grid; place-items: center;
    width: 32px; height: 32px; border: 0; border-radius: 999px;
    background: none; color: var(--ink-soft); cursor: pointer;
}

.sippy-avatar.is-animating .sippy-turtle { display: inline-block; }
.sippy[data-mood="happy"] .is-animating .sippy-turtle { animation: wiggle 0.6s ease-in-out 2; }
.sippy[data-mood="cheer"] .is-animating .sippy-turtle { animation: hop 0.5s ease-out 3; }
.sippy[data-mood="worried"] .is-animating .sippy-turtle { animation: shake 0.35s ease-in-out 3; }
.sippy[data-mood="think"] .is-animating .sippy-turtle { animation: tilt 1.6s ease-in-out 1; }
.sippy[data-mood="wave"] .is-animating .sippy-turtle { animation: wiggle 0.8s ease-in-out 1; }
.sippy[data-mood="worried"] .sippy-card { border-color: var(--coral); }
.sippy[data-mood="cheer"] .sippy-card { border-color: var(--sun); }

/* ───────── Modal ───────── */
.modal {
    position: fixed; inset: 0; z-index: 80;
    display: grid; place-items: center;
    padding: 16px;
    background: rgba(6, 30, 45, 0.6);
}
.modal[hidden] { display: none; }
.modal-card { position: relative; width: min(460px, 100%); padding: 24px; display: grid; gap: 16px; }
.modal-close { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 999px; background: var(--sand-2); cursor: pointer; }
.settings-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.settings-stats div { background: var(--white); border-radius: var(--r-md); padding: 10px 12px; }
.settings-stats dt { font-size: 0.8rem; color: var(--ink-soft); }
.settings-stats dd { margin: 0; font-family: var(--font-display); font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.settings-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

/* ───────── Motion ───────── */
@keyframes sippy-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes tilt { 0%, 100% { transform: rotate(0); } 30%, 70% { transform: rotate(-14deg) translateY(-2px); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes pulse-ring { 0% { transform: scale(0.85); opacity: 0.9; } 100% { transform: scale(1.35); opacity: 0; } }
@keyframes burst { 0% { transform: scale(0.2); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes pop-in { 0% { transform: scale(0.3); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes bubble { 0% { transform: translateY(0) scale(0.6); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-70px) scale(1); opacity: 0; } }
@keyframes rain { from { transform: translateY(-4px); } to { transform: translateY(4px); } }
@keyframes sail { from { transform: translate(-80px, 520px); } to { transform: translate(1080px, 470px); } }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-80px); } }
@keyframes dot { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
