:root {
  --sea-1: #04263f; --sea-2: #075985; --sea-3: #0ea5e9; --sand: #f6d8a0; --sun: #f5a623; --leaf: #22c55e;
  --card: rgba(6, 30, 52, 0.72); --line: rgba(255, 255, 255, 0.12); --text: #f1f5f9; --muted: #a5c3d6;
  --radius: 16px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--sea-1); overflow: hidden; }
body { background: radial-gradient(1200px 700px at 80% -10%, #155e75 0%, transparent 60%), linear-gradient(160deg, var(--sea-1), #062e4d 50%, #0b3b5c); }
#backdrop { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .35; filter: saturate(1.1) blur(1px); image-rendering: pixelated; pointer-events: none; }
#launcher { position: relative; max-width: 860px; margin: 0 auto; height: 100%; overflow-y: auto; padding: 32px 20px 24px; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; align-items: center; gap: 16px; }
.logo img, .logo svg { width: 64px; height: 64px; image-rendering: pixelated; filter: drop-shadow(0 6px 18px rgba(245, 166, 35, .35)); }
h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: .5px; font-weight: 800;
  background: linear-gradient(90deg, #fde68a, var(--sun) 40%, #38bdf8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tag { margin: 2px 0 0; color: var(--muted); }
.card { background: var(--card); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 20px 40px rgba(0, 0, 0, .25); }
.card h2 { margin: 0 0 6px; font-size: 18px; }
summary { cursor: pointer; font-weight: 700; font-size: 16px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.discs { display: grid; gap: 10px; margin: 12px 0; }
.disc { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .04); }
.disc .flag { font-size: 22px; }
.disc .meta { flex: 1; } .disc .meta b { display: block; } .disc .meta span { font-size: 12.5px; color: var(--muted); }
.drop { border: 2px dashed rgba(255, 255, 255, .22); border-radius: 14px; padding: 18px; text-align: center; transition: .15s; }
.drop.over { border-color: var(--sun); background: rgba(245, 166, 35, .08); }
.drop-inner { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.btn { appearance: none; border: 1px solid var(--line); background: rgba(255, 255, 255, .08); color: var(--text); padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; transition: .15s; }
.btn:hover { background: rgba(255, 255, 255, .15); }
.btn.primary { background: linear-gradient(180deg, #fbbf24, #f59e0b); color: #3b2300; border: none; box-shadow: 0 8px 24px rgba(245, 158, 11, .35); }
.btn.primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.big { font-size: 18px; padding: 12px 28px; }
.btn.danger { color: #fecaca; }
.btn input[type=file] { display: none; }
.row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.grow { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; margin-top: 14px; }
select, input[type=range] { width: 100%; }
select { background: rgba(255, 255, 255, .08); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; }
option { background: #0b3b5c; }
input[type=range] { accent-color: var(--sun); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--text); padding: 9px 16px; font: inherit; cursor: pointer; }
.seg button.on { background: rgba(56, 189, 248, .25); font-weight: 700; }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.urlrow { margin-top: 12px; display: grid; gap: 6px; font-size: 14px; }
.urlin { display: flex; gap: 8px; }
.urlin input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(0, 0, 0, .25); color: inherit; font: inherit; }
.urlin input:focus { outline: 2px solid var(--sun); outline-offset: 0; }
.status .btn { margin-top: 8px; }
.status { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .06); font-size: 14px; }
.status.err { background: rgba(239, 68, 68, .16); color: #fecaca; }
.progress { height: 6px; background: rgba(255, 255, 255, .1); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress > i.indet { animation: indet 1.2s ease-in-out infinite alternate; opacity: .6; }
@keyframes indet { from { opacity: .25; } to { opacity: .8; } }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--sun), #38bdf8); width: 0; transition: width .2s; }
footer { text-align: center; margin-top: auto; } footer a { color: var(--muted); }

#game { position: fixed; inset: 0; background: #000; }
#screen { position: absolute; inset: 0; width: 100%; height: 100%; outline: none; cursor: none; }
#game.hud-visible #loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--muted); background: radial-gradient(circle at center, #0b3b5c, #000 70%); }
#loading[hidden] { display: none; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .15); border-top-color: var(--sun); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#modal, #drawer { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; z-index: 10; backdrop-filter: blur(3px); }
#modal[hidden], #drawer[hidden] { display: none; }
.dialog { background: #0b2e4a; border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; max-width: 460px; width: calc(100% - 40px); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.dialog.wide { max-width: 720px; }
.dialog h3 { margin: 0 0 8px; }
.dialog p { white-space: pre-wrap; line-height: 1.45; }
.buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.badge { display: inline-block; min-width: 22px; padding: 1px 8px; margin-left: 6px; border-radius: 999px; background: rgba(56, 189, 248, .22); font-size: 12px; font-weight: 700; vertical-align: 2px; }
.mods-bar { margin: 10px 0; align-items: center; }
.modlist { display: flex; flex-direction: column; gap: 6px; }
.modcat { margin: 12px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.mod { border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .04); padding: 10px 12px; }
.mod.off { opacity: .78; }
.mod.na { opacity: .45; }
.mod-head { display: flex; gap: 12px; align-items: flex-start; }
.mod-head .meta { flex: 1; min-width: 0; }
.mod-head b { font-size: 15px; }
.mod-head .desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tagpill { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.tagpill.exp { color: #fde68a; border-color: rgba(253, 230, 138, .4); }
.switch { position: relative; width: 42px; height: 24px; flex: none; margin-top: 2px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, .18); transition: .15s; cursor: pointer; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + i { background: var(--sun); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:disabled + i { cursor: not-allowed; }
.mod-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 16px; margin: 10px 0 2px 54px; }
.mod-settings .field { min-width: 0; }
.mod-settings input[type=text] { background: rgba(255, 255, 255, .08); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; }
.mod-settings .chk { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.ghost { background: transparent; }
.mod-overlay { position: absolute; inset: 0; pointer-events: none; }
#screen { touch-action: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(90vw, 720px); padding: 10px 16px; border-radius: 12px; background: rgba(6, 30, 52, .92); border: 1px solid var(--line); color: var(--text); font-size: 14px; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: opacity .5s; pointer-events: none; }
.toast.out { opacity: 0; }
@media (max-width: 640px) { #launcher { padding: 16px 10px; } .card { padding: 14px; } .mod-settings { margin-left: 0; } }
.project { font-size: 12px; letter-spacing: .25em; text-transform: uppercase; color: var(--sun); font-weight: 700; opacity: .9; }

.field.wide { grid-column: 1 / -1; }
.field input[type=url] { padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(0, 0, 0, .25); color: inherit; font: inherit; }
.field small { font-size: 12px; }
.grid > h4 { grid-column: 1 / -1; margin: 6px 0 -6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.grid > h4:first-child { margin-top: 0; }
.field label.chk { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.savelist { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; margin-top: 4px; text-align: left; }
.saverow { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; background: rgba(127,127,127,.12); }
.saverow .meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.saverow .meta span { font-size: 12px; opacity: .75; }
.field[hidden] { display: none !important; }
.field label.chk { justify-content: flex-start; }

/* windows of mod page scripts (api.window), in the game's style */
.hi-win { position: absolute; pointer-events: auto; display: flex; flex-direction: column; background: #af8f63; color: #171717;
  border: 1px solid #171717; box-shadow: inset 1px 1px 0 #e7d3b3, inset -1px -1px 0 #6b5233, 4px 4px 0 rgba(0,0,0,.35);
  font: bold 12px/1.4 "MS Sans Serif", "Microsoft Sans Serif", Tahoma, Verdana, sans-serif; user-select: none; z-index: 50; }
.hi-win[hidden] { display: none; }
.hi-win > .cap { position: relative; flex: none; height: 18px; margin: 2px 2px 0; display: flex; align-items: center; justify-content: center; cursor: move; touch-action: none;
  color: #ff0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; text-shadow: 1px 1px 0 #3a0a5a; border-bottom: 1px solid #171717;
  background: repeating-linear-gradient(115deg, #9737c7 0 5px, #731fa3 5px 7px, #67178f 7px 10px, #9737c7 10px 15px, #3cb8c8 15px 16px, #9737c7 16px 21px); }
.hi-win > .cap .x { position: absolute; left: 2px; top: 2px; width: 13px; height: 13px; padding: 0; border: none; cursor: pointer;
  background: #b3b3b3; box-shadow: inset 1px 1px 0 #efefef, inset -1px -1px 0 #555; }
.hi-win > .cap .x::after { content: ''; position: absolute; left: 3px; top: 5px; width: 7px; height: 2px; background: #171717; }
.hi-win > .body { overflow-y: auto; padding: 4px 0 8px; }
.hi-win .inset { background: #876b47; color: #f7ecd6; box-shadow: inset 1px 1px 0 #5a4428, inset -1px -1px 0 #c3a377; }
.hi-win button:not(.x) { font: inherit; color: #171717; background: #e7d3b3; border: 1px solid #171717; padding: 3px 8px; cursor: pointer;
  box-shadow: inset -1px -1px 0 #c3a377, inset 1px 1px 0 #fff4dc; border-radius: 0; }
.hi-win button:not(.x):hover:not(:disabled) { background: #f0dfc2; }
.hi-win button:not(.x):active:not(:disabled) { box-shadow: inset 1px 1px 0 #c3a377, inset -1px -1px 0 #fff4dc; }
.hi-win button:disabled { opacity: .5; cursor: default; }

.pausedNote { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); padding: 12px 20px; background: rgba(20, 12, 4, .82);
  color: #ffe66e; font: 600 16px/1.3 system-ui, sans-serif; border: 1px solid #ffe66e55; border-radius: 6px; pointer-events: none; z-index: 60; }
.pausedNote[hidden] { display: none; }
/* music player */
.jukebox { display: flex; flex-direction: column; gap: 8px; min-width: min(420px, 80vw); }
.jbList { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }
.jbRow { display: flex; gap: 10px; align-items: center; text-align: left; padding: 6px 10px; border: 1px solid transparent; border-radius: 6px; background: rgba(255,255,255,.04); color: inherit; font: inherit; cursor: pointer; }
.jbRow:hover { background: rgba(255,255,255,.1); }
.jbRow.on { border-color: var(--accent, #ffb84d); background: rgba(255,184,77,.15); }
.jbRow b { width: 1.2em; opacity: .7; }
.jbBar { display: flex; gap: 8px; align-items: center; }
.jbBar input[type=range] { flex: 1; }
.jbNow { min-width: 6.5em; font-variant-numeric: tabular-nums; }
.jbBar label.chk { display: flex; gap: 4px; align-items: center; white-space: nowrap; }
