@font-face { font-family: "Baloo 2"; font-weight: 700; font-display: swap; src: url(vendor/fonts/baloo-2-vietnamese-700-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Baloo 2"; font-weight: 800; font-display: swap; src: url(vendor/fonts/baloo-2-vietnamese-800-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Baloo 2"; font-weight: 700; font-display: swap; src: url(vendor/fonts/baloo-2-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+2020, U+20A0-20AB, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Baloo 2"; font-weight: 800; font-display: swap; src: url(vendor/fonts/baloo-2-latin-ext-800-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+2020, U+20A0-20AB, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Baloo 2"; font-weight: 700; font-display: swap; src: url(vendor/fonts/baloo-2-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+02BB-02DC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Baloo 2"; font-weight: 800; font-display: swap; src: url(vendor/fonts/baloo-2-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+02BB-02DC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: Nunito; font-weight: 500; font-display: swap; src: url(vendor/fonts/nunito-vietnamese-500-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: Nunito; font-weight: 700; font-display: swap; src: url(vendor/fonts/nunito-vietnamese-700-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: Nunito; font-weight: 500; font-display: swap; src: url(vendor/fonts/nunito-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+2020, U+20A0-20AB, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Nunito; font-weight: 700; font-display: swap; src: url(vendor/fonts/nunito-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+1E00-1E9F, U+2020, U+20A0-20AB, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Nunito; font-weight: 500; font-display: swap; src: url(vendor/fonts/nunito-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+02BB-02DC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: Nunito; font-weight: 700; font-display: swap; src: url(vendor/fonts/nunito-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+02BB-02DC, U+2000-206F, U+20AC, U+2122; }

:root {
  --abyss: #0a2159; --deep: #123a85; --sea: #1c52a8; --sea-hi: #2a6fc9; --sky: #7cc8ff; --foam: #e9f7ff;
  --text: #ffffff; --soft: #d6ebff; --dim: #a9cdf5;
  --gold: #ffd93b; --gold-deep: #ffb400; --gold-edge: #b86f00; --gold-ink: #4a2a00; --coral: #ff8a3c; --danger: #ffb4a8;
  --panel: 560px;
  --display: "Baloo 2", "Nunito", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--abyss); color: var(--text); font: 500 14px/1.45 Nunito, "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button:focus-visible, select:focus-visible, summary:focus-visible, input:focus-visible, .split:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: var(--sky) transparent; }

.app { display: grid; grid-template-columns: var(--panel) 12px minmax(0, 1fr); height: 100dvh; }
body.dragging { cursor: col-resize; user-select: none; }

/* ── Left column ── */
.side { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: linear-gradient(180deg, var(--deep), var(--abyss)); }

/* Sky, clouds and a wave into the sea */
.hero { position: relative; flex: none; height: 98px; overflow: hidden; background: linear-gradient(180deg, #4fb0ff 0%, #a4dcff 72%, #e4f5ff 100%); }
.cloud { position: absolute; fill: #fff; opacity: .9; }
.c1 { width: 96px; left: -22px; top: 18px; }
.c2 { width: 74px; right: 10px; top: 6px; opacity: .75; }
.wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 30px; }
.wave .w1 { fill: #fff; opacity: .85; }
.wave .w2 { fill: var(--deep); }
.logo { position: relative; z-index: 1; margin: 0; padding: 6px 18px 0; display: flex; align-items: center; gap: 12px; font: 800 38px/1 var(--display); }
.word { display: inline-flex; gap: 1px; }
.word b { display: inline-block; font-weight: 800; color: #fff; transform: rotate(var(--r)); text-shadow: 1px 1px 0 #ffb066, 2px 2px 0 var(--coral), 3px 3px 0 var(--coral), 4px 4px 0 #e0641a, 5px 5px 0 #c9530f, 6px 7px 6px rgba(10, 33, 89, .35); }
.mascot { width: 46px; height: 46px; object-fit: contain; transform: scaleX(-1); animation: bob 2.6s ease-in-out infinite; }
.tag { margin-left: auto; padding: 1px 12px 0; border-radius: 999px; background: var(--deep); color: #fff; font: 700 15px/1.7 var(--display); box-shadow: 0 2px 0 var(--abyss); }
@keyframes bob { 50% { transform: scaleX(-1) translateY(-5px) rotate(-5deg); } }

.warn { margin: 8px 16px 0; padding: 8px 10px; border-radius: 10px; background: #5b3a06; color: #ffe39a; font-size: 13px; }
.sections { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 10px; }

/* Game-style panels */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.sec { flex: none; background: var(--deep); border: 2px solid rgba(124, 200, 255, .45); border-radius: 14px; box-shadow: 0 3px 0 rgba(4, 18, 56, .8); overflow: hidden; }
.secHead { display: flex; align-items: center; gap: 10px; padding: 7px 12px 7px 14px; background: linear-gradient(180deg, var(--sea-hi), var(--sea)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
details.sec > summary.secHead:hover { background: linear-gradient(180deg, #3a80da, #2360b8); }
.secHead h2 { margin: 0; font: 800 18px/1.4 var(--display); white-space: nowrap; text-shadow: 0 2px 0 rgba(10, 33, 89, .6); }
.sum { flex: 1; min-width: 0; text-align: right; color: var(--soft); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { flex: none; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #a8dcff 70%); position: relative; box-shadow: 0 1px 0 rgba(10, 33, 89, .6); }
.chev::after { content: ""; position: absolute; left: 7px; top: 5.5px; width: 7px; height: 7px; border-right: 2.5px solid var(--sea); border-bottom: 2.5px solid var(--sea); transform: rotate(-45deg); transition: transform .15s; }
details[open] > summary .chev::after { transform: translate(0, 1px) rotate(45deg); }
.secBody { padding: 10px 12px 12px; }
.subs { display: flex; flex-direction: column; gap: 6px; }

.sub { background: rgba(255, 255, 255, .07); border-radius: 10px; }
.sub > summary { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 12px; border-radius: 10px; }
.sub > summary:hover { background: rgba(255, 255, 255, .09); }
.sub > summary h3 { margin: 0; flex: 1; font: 700 15px/1.4 var(--display); }
.sub .chev { width: 18px; height: 18px; }
.sub .chev::after { left: 5.5px; top: 4px; width: 6px; height: 6px; border-width: 2px; }
.chip { font-size: 12px; color: var(--dim); }
.chip.on { padding: 0 8px; border-radius: 999px; background: var(--gold); color: var(--gold-ink); font-weight: 700; }
.subBody { padding: 2px 12px 12px; }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 2px 24px; }
.row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 52px; gap: 10px; align-items: center; min-height: 38px; }
.row > label, .row > .lab { color: var(--soft); font-size: 13px; }
.row output { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700; }
.row.pick { grid-template-columns: 92px minmax(0, 1fr); }
.hint { margin: 8px 0 0; font-size: 12.5px; color: var(--soft); }
.hint.err { color: var(--danger); }
.hint.note { color: var(--gold); }

/* Slider: a small fish swims along the line */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; margin: 0; cursor: pointer; --p: 50%; }
input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--gold) var(--p), var(--abyss) var(--p)); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .35); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 22px; margin-top: -7px; border: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 22'%3E%3Cpath d='M24 11l5-6v12z' fill='%23e0641a' stroke='%23fff' stroke-width='1.2'/%3E%3Cellipse cx='14' cy='11' rx='12' ry='9' fill='%23ff8a3c' stroke='%23fff' stroke-width='1.6'/%3E%3Cpath d='M13 2.6c3 2.6 3 14.2 0 16.8' fill='none' stroke='%23fff' stroke-width='2.4'/%3E%3Ccircle cx='7' cy='9' r='3.2' fill='%23fff'/%3E%3Ccircle cx='6.4' cy='9' r='1.7' fill='%230a2159'/%3E%3C/svg%3E") center / contain no-repeat; }
input[type=range]::-moz-range-track { height: 8px; border-radius: 4px; background: var(--abyss); }
input[type=range]::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--gold); }
input[type=range]::-moz-range-thumb { width: 30px; height: 22px; border: 0; border-radius: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 22'%3E%3Cpath d='M24 11l5-6v12z' fill='%23e0641a' stroke='%23fff' stroke-width='1.2'/%3E%3Cellipse cx='14' cy='11' rx='12' ry='9' fill='%23ff8a3c' stroke='%23fff' stroke-width='1.6'/%3E%3Cpath d='M13 2.6c3 2.6 3 14.2 0 16.8' fill='none' stroke='%23fff' stroke-width='2.4'/%3E%3Ccircle cx='7' cy='9' r='3.2' fill='%23fff'/%3E%3Ccircle cx='6.4' cy='9' r='1.7' fill='%230a2159'/%3E%3C/svg%3E") center / contain no-repeat; }

.seg { display: flex; background: var(--abyss); border-radius: 10px; padding: 3px; gap: 2px; min-width: 0; }
.seg button { flex: 1; min-width: 0; border: 0; background: transparent; padding: 4px 6px; border-radius: 8px; cursor: pointer; color: var(--soft); font-size: 13px; font-weight: 700; white-space: nowrap; }
.seg button:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.seg button[aria-pressed=true] { background: linear-gradient(180deg, var(--gold), var(--gold-deep)); color: var(--gold-ink); box-shadow: 0 2px 0 var(--gold-edge); }

.drop { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 5px 0; padding: 6px 8px; background: rgba(255, 255, 255, .1); border: 2px dashed rgba(167, 217, 255, .55); border-radius: 12px; cursor: pointer; position: relative; }
.drop:hover, .drop.over { background: rgba(255, 255, 255, .17); border-color: #fff; }
.drop.over { border-color: var(--gold); }
.drop:focus-within { outline: 3px solid var(--gold); outline-offset: 1px; }
.drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.thumb { width: 48px; height: 40px; border-radius: 8px; object-fit: contain; display: block; background: repeating-conic-gradient(#3a6db8 0 25%, #285594 0 50%) 0 0 / 10px 10px; }
.thumb.empty { width: 40px; margin-left: 4px; border-radius: 50%; display: grid; place-items: center; color: var(--sea); font-size: 15px; font-weight: 700; background: radial-gradient(circle at 35% 30%, #fff, #a8dcff 75%); }
.dropText { min-width: 0; }
.dropText b { display: block; font-weight: 700; font-size: 13.5px; }
.dropText small { display: block; color: var(--soft); font-size: 12px; overflow-wrap: anywhere; }
.linkBtn { border: 0; background: none; color: var(--soft); cursor: pointer; font-size: 12px; padding: 4px; }
.linkBtn:hover { color: #fff; text-decoration: underline; }

select { width: 100%; background: var(--abyss); border: 1px solid var(--sky); border-radius: 8px; padding: 5px 6px; }
.handPick { position: relative; margin-top: 6px; width: 110px; cursor: crosshair; background: repeating-conic-gradient(#3a6db8 0 25%, #285594 0 50%) 0 0 / 12px 12px; border-radius: 8px; overflow: hidden; }
.handPick img { display: block; width: 100%; }
.handDot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border: 2px solid #fff; background: var(--coral); border-radius: 50%; pointer-events: none; }

.exportBar { padding: 10px 16px 14px; background: var(--abyss); box-shadow: 0 -2px 0 rgba(124, 200, 255, .3); }
.exportRow { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(170px, 1.2fr); gap: 12px; align-items: center; }
.btn { border: 0; cursor: pointer; width: 100%; text-align: center; }
.btn.primary { padding: 5px 16px 2px; border-radius: 10px; transform: skewX(-9deg); background: linear-gradient(180deg, #ffe874, var(--gold) 45%, var(--gold-deep)); color: var(--gold-ink); font: 800 21px/1.4 var(--display); box-shadow: 0 4px 0 var(--gold-edge), 0 7px 10px rgba(0, 0, 0, .35); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:active { transform: skewX(-9deg) translateY(3px); box-shadow: 0 1px 0 var(--gold-edge); }
.btn.ghost { display: block; margin-top: 10px; padding: 7px 14px; border-radius: 10px; background: linear-gradient(180deg, #c9ebff, #82c7f7); color: var(--abyss); font-weight: 700; text-decoration: none; box-shadow: 0 3px 0 #3f86c4; }
.progress { height: 10px; border-radius: 5px; background: var(--deep); margin-top: 12px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--coral)); }

/* ── Divider ── */
.split { cursor: col-resize; display: grid; place-items: center; background: var(--abyss); touch-action: none; }
.split i { width: 8px; height: 44px; border-radius: 4px; background: var(--sea-hi); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4); }
.split:hover i, body.dragging .split i { background: var(--gold); }

/* ── Right column: under the sea ── */
.stage { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 16px; min-width: 0; min-height: 0; background: radial-gradient(90% 55% at 50% 0%, #2c78cf 0%, transparent 72%), linear-gradient(180deg, #164a9d, var(--abyss) 80%); }
.bub { position: absolute; bottom: -30px; border-radius: 50%; border: 2px solid rgba(214, 235, 255, .5); background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .55), transparent 45%); animation: rise 11s linear infinite; }
.b1 { left: 8%; width: 18px; height: 18px; }
.b2 { left: 90%; width: 28px; height: 28px; animation-duration: 15s; animation-delay: -6s; }
.b3 { left: 15%; width: 10px; height: 10px; animation-duration: 8s; animation-delay: -3s; }
@keyframes rise { to { transform: translateY(-110vh); } }
.canvasBox { position: relative; flex: 1; min-height: 0; width: 100%; container-type: size; display: grid; place-items: center; }
canvas { display: block; width: min(100cqw, 56.25cqh); height: auto; aspect-ratio: 9 / 16; border-radius: 14px; background: #000; box-shadow: 0 0 0 3px #9edaff, 0 0 26px rgba(124, 200, 255, .55); }
.status { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; font: 700 20px var(--display); background: var(--abyss); border-radius: 14px; }
.status:empty { display: none; }
.transport { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; max-width: 480px; }
.round { width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer; flex: none; font-size: 12px; color: var(--sea); font-weight: 700; background: radial-gradient(circle at 35% 30%, #fff, #a8dcff 75%); box-shadow: 0 2px 0 rgba(4, 18, 56, .8); }
.round:hover { filter: brightness(1.07); }
.bar { flex: 1; min-width: 20px; height: 8px; background: var(--abyss); border-radius: 4px; overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--gold); }
#clock { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--soft); white-space: nowrap; }
.check { display: flex; gap: 5px; align-items: center; font-size: 13px; color: var(--soft); white-space: nowrap; cursor: pointer; }
.check input { accent-color: var(--gold); margin: 0; }
.summary { position: relative; margin: 0; font-size: 13px; color: var(--soft); text-align: center; max-width: 480px; min-height: 19px; }
.summary b { color: #fff; font-weight: 700; }
.summary .bad { color: var(--gold); }

@media (prefers-reduced-motion: reduce) { .mascot, .bub { animation: none; } .chev::after { transition: none; } }
@media (max-width: 800px) {
  html, body { height: auto; }
  .app { display: flex; flex-direction: column-reverse; height: auto; }
  .split { display: none; }
  .logo { font-size: 32px; gap: 8px; }
  .sections { overflow: visible; }
  .exportBar { position: sticky; bottom: 0; }
  .canvasBox { flex: none; height: 56vh; }
}
