:root {
	--panel: rgba(18, 52, 96, 0.88);
	--panel2: rgba(28, 74, 130, 0.92);
	--panel-hi: rgba(64, 140, 210, 0.95);
	--edge: rgba(150, 210, 255, 0.55);
	--text: #f4f8ff;
	--muted: #a9c3e0;
	--accent: #7fe07a;
	--warn: #ffcf4a;
	--bad: #ff6a6a;
	--gold: #ffd76a;
	--font: "Trebuchet MS", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body {
	margin: 0; padding: 0; width: 100%; height: 100%;
	overflow: hidden; background: #0d1a2b; color: var(--text);
	font-family: var(--font); user-select: none; -webkit-user-select: none;
	overscroll-behavior: none; touch-action: none;
}
#app { position: fixed; inset: 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
#ui { position: absolute; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
.hidden { display: none !important; }
button { font-family: var(--font); cursor: pointer; }
input, select { font-family: var(--font); }

.glass {
	background: linear-gradient(180deg, var(--panel2), var(--panel));
	border: 1px solid var(--edge);
	border-radius: 14px;
	box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn {
	background: linear-gradient(180deg, #5aa8ea, #2c6fb6);
	border: 1px solid rgba(190, 230, 255, 0.7);
	color: #fff; border-radius: 10px; padding: 7px 14px; font-size: 14px; font-weight: bold;
	text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 2px 5px rgba(0, 0, 0, 0.3);
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn.green { background: linear-gradient(180deg, #7ad86a, #36923a); }
.btn.red { background: linear-gradient(180deg, #f07a6a, #b6382c); }
.btn.gray { background: linear-gradient(180deg, #8aa0b8, #4f6580); }
.btn.small { padding: 4px 9px; font-size: 12px; border-radius: 8px; }
.btn:disabled { filter: grayscale(0.8) brightness(0.8); cursor: default; }

/* ---------- Action queue ---------- */
#queue { position: absolute; left: 14px; top: 14px; display: flex; align-items: flex-start; gap: 6px; }
.q-item {
	width: 46px; height: 46px; border-radius: 50%;
	background: radial-gradient(circle at 35% 30%, #6ab6f2, #1f5a9a);
	border: 2px solid rgba(200, 235, 255, 0.85);
	display: flex; align-items: center; justify-content: center; font-size: 22px;
	position: relative; cursor: pointer; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}
.q-item.current { width: 64px; height: 64px; font-size: 32px; border-color: #bfffb0; }
.q-item .x { position: absolute; right: -3px; top: -3px; width: 18px; height: 18px; border-radius: 50%; background: #d23; color: #fff; font-size: 11px; display: none; align-items: center; justify-content: center; border: 1px solid #fff; }
.q-item:hover .x { display: flex; }
.q-label { position: absolute; left: 14px; top: 84px; font-size: 13px; background: rgba(10, 30, 60, 0.75); padding: 3px 9px; border-radius: 8px; max-width: 300px; }

/* ---------- Bottom left: modes + time ---------- */
#modebar { position: absolute; left: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; padding: 7px; }
.mode-btn {
	width: 52px; height: 52px; border-radius: 12px; font-size: 24px; border: 1px solid var(--edge);
	background: linear-gradient(180deg, #3a7dc4, #1b4a86); color: #fff; position: relative;
}
.mode-btn.on { background: linear-gradient(180deg, #8ee07a, #3a9a3e); border-color: #dfffd0; }
.mode-btn span { position: absolute; left: 60px; top: 14px; white-space: nowrap; font-size: 12px; background: rgba(10, 30, 60, 0.85); padding: 3px 8px; border-radius: 6px; display: none; }
.mode-btn:hover span { display: block; }

#timepanel { position: absolute; left: 84px; bottom: 12px; width: 196px; padding: 9px 11px; }
#clock { font-size: 26px; font-weight: bold; text-shadow: 0 2px 3px rgba(0, 0, 0, 0.4); }
#daylbl { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
#speeds { display: flex; gap: 4px; }
.spd { flex: 1; height: 30px; border-radius: 8px; font-size: 13px; font-weight: bold; color: #fff; border: 1px solid var(--edge); background: linear-gradient(180deg, #3a7dc4, #1b4a86); padding: 0; }
.spd.on { background: linear-gradient(180deg, #8ee07a, #3a9a3e); }
.spd.locked { opacity: 0.35; }
#funds { margin-top: 8px; font-size: 20px; font-weight: bold; color: var(--accent); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); display: flex; justify-content: space-between; align-items: center; }
#funds small { font-size: 11px; color: var(--muted); font-weight: normal; }

/* ---------- Household portraits ---------- */
#portraits { position: absolute; left: 16px; bottom: 270px; display: flex; flex-direction: column-reverse; gap: 6px; }
.portrait-btn { width: 54px; height: 54px; border-radius: 50%; border: 2px solid rgba(200, 235, 255, 0.6); overflow: hidden; padding: 0; background: #20406a; position: relative; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4); }
.portrait-btn.on { border-color: #9dff7a; box-shadow: 0 0 0 3px rgba(130, 255, 110, 0.4), 0 3px 8px rgba(0, 0, 0, 0.4); }
.portrait-btn canvas { width: 100%; height: 100%; display: block; }
.portrait-btn .away { position: absolute; bottom: 0; left: 0; right: 0; font-size: 9px; background: rgba(0, 0, 0, 0.6); }

/* ---------- Sim panel ---------- */
#simpanel { position: absolute; left: 290px; bottom: 12px; width: 640px; height: 196px; display: flex; padding: 8px; gap: 8px; }
#sp-left { width: 116px; display: flex; flex-direction: column; align-items: center; }
#sp-portrait { width: 96px; height: 96px; border-radius: 50%; border: 3px solid rgba(200, 235, 255, 0.8); background: #1e3c64; }
#sp-name { font-weight: bold; font-size: 14px; margin-top: 4px; text-align: center; line-height: 1.1; }
#sp-mood { font-size: 11px; color: var(--muted); text-align: center; margin-top: 2px; }
#sp-tabs { display: flex; flex-direction: column; gap: 3px; }
.tab { width: 36px; height: 25px; border-radius: 7px; border: 1px solid var(--edge); background: linear-gradient(180deg, #3a7dc4, #1b4a86); font-size: 14px; padding: 0; color: #fff; }
.tab.on { background: linear-gradient(180deg, #8ee07a, #3a9a3e); }
#sp-content { flex: 1; overflow-y: auto; padding: 2px 6px; font-size: 13px; }
#sp-content::-webkit-scrollbar { width: 8px; }
#sp-content::-webkit-scrollbar-thumb { background: rgba(160, 210, 255, 0.4); border-radius: 4px; }
.sp-title { font-weight: bold; font-size: 14px; margin-bottom: 4px; color: #d8ecff; display: flex; justify-content: space-between; align-items: center; }

.need { display: grid; grid-template-columns: 22px 64px 1fr; align-items: center; gap: 6px; margin: 3px 0; }
.need-bar { height: 14px; background: rgba(0, 0, 0, 0.35); border-radius: 7px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.2); }
.need-fill { height: 100%; border-radius: 7px; transition: width 0.3s; }
.needs-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }

.moodmeter { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #d84040, #e8b040 45%, #7ad86a 55%, #3ab0e8); position: relative; margin: 2px 0 8px; border: 1px solid rgba(255, 255, 255, 0.3); }
.moodmeter .pin { position: absolute; top: -4px; width: 6px; height: 22px; background: #fff; border-radius: 3px; box-shadow: 0 0 4px #000; transform: translateX(-3px); }
.moodlets { display: flex; flex-wrap: wrap; gap: 5px; }
.moodlet { width: 54px; text-align: center; font-size: 10px; line-height: 1.1; position: relative; }
.moodlet .ic { width: 40px; height: 40px; margin: 0 auto 2px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 22px; border: 2px solid; }
.moodlet.pos .ic { background: rgba(80, 180, 90, 0.35); border-color: #8ee07a; }
.moodlet.neg .ic { background: rgba(200, 70, 60, 0.35); border-color: #ff8a7a; }
.moodlet .v { position: absolute; top: -3px; right: 2px; font-size: 10px; font-weight: bold; background: rgba(0, 0, 0, 0.6); border-radius: 6px; padding: 0 3px; }

.skill-row { display: grid; grid-template-columns: 22px 80px 1fr 28px; align-items: center; gap: 6px; margin: 3px 0; }
.pips { display: flex; gap: 2px; }
.pip { flex: 1; height: 10px; border-radius: 3px; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.15); position: relative; overflow: hidden; }
.pip.full { background: #6ad0ff; }
.pip .part { position: absolute; left: 0; top: 0; bottom: 0; background: #3a8ab8; }

.rel-row { display: grid; grid-template-columns: 34px 1fr 90px; align-items: center; gap: 6px; padding: 3px; border-radius: 8px; cursor: pointer; }
.rel-row:hover { background: rgba(255, 255, 255, 0.08); }
.rel-row canvas { width: 32px; height: 32px; border-radius: 50%; }
.relbar { height: 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.35); position: relative; overflow: hidden; }
.relbar .f { position: absolute; top: 0; bottom: 0; }
.trait-chip { display: inline-flex; align-items: center; gap: 4px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 10px; padding: 2px 8px; margin: 2px; font-size: 12px; }

/* ---------- Wish bar ---------- */
#wishbar { position: absolute; left: 290px; bottom: 214px; width: 640px; height: 58px; display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 0 8px; background: none; border: none; box-shadow: none; pointer-events: none; }
#wishbar > * { pointer-events: auto; }
.wish { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; cursor: pointer; position: relative; border: 2px solid rgba(255, 255, 255, 0.7); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4); }
.wish.offer { background: radial-gradient(circle at 35% 30%, #ffffff, #b8daf5); animation: bob 3s ease-in-out infinite; }
.wish.promised { background: radial-gradient(circle at 35% 30%, #fff6b0, #e8b830); border-color: #fff4c0; }
.wish.empty { background: rgba(10, 30, 60, 0.6); border-style: dashed; cursor: default; }
.wish .pts { position: absolute; bottom: -8px; font-size: 9px; background: rgba(0, 0, 0, 0.7); padding: 0 4px; border-radius: 6px; }
.wish .dx { position: absolute; right: -4px; top: -4px; width: 16px; height: 16px; border-radius: 50%; background: #d23; color: #fff; font-size: 10px; display: none; align-items: center; justify-content: center; }
.wish:hover .dx { display: flex; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.wish-sep { width: 2px; height: 40px; background: rgba(255, 255, 255, 0.3); margin: 0 4px; }
#lhp { min-width: 110px; padding: 5px 9px; font-size: 12px; text-align: center; cursor: pointer; }
#lhp b { color: var(--gold); font-size: 15px; }
#ltw { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; position: relative; cursor: pointer; background: conic-gradient(#ffd76a var(--p, 0%), rgba(10, 30, 60, 0.7) 0); border: 2px solid #fff4c0; }
#ltw .in { width: 36px; height: 36px; border-radius: 50%; background: #1e3c64; display: flex; align-items: center; justify-content: center; }

/* ---------- Notifications ---------- */
#notifs { position: absolute; right: 12px; top: 12px; width: 320px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.notif { pointer-events: auto; padding: 9px 12px 10px 52px; position: relative; font-size: 13px; animation: slidein 0.35s ease-out; cursor: pointer; }
.notif .ic { position: absolute; left: 10px; top: 10px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, 0.15); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.notif .t { font-weight: bold; margin-bottom: 2px; }
.notif .close { position: absolute; right: 6px; top: 4px; font-size: 12px; opacity: 0.7; }
.notif.urgent { border-color: #ff9a7a; box-shadow: 0 0 14px rgba(255, 100, 60, 0.6); }
.notif.fade { opacity: 0; transform: translateX(30px); transition: all 0.5s; }
@keyframes slidein { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }

/* ---------- Camera controls ---------- */
#camctl { position: absolute; right: 12px; bottom: 12px; display: grid; grid-template-columns: repeat(2, 40px); gap: 5px; padding: 6px; }
#camctl.edit { bottom: 238px; grid-template-columns: none; grid-auto-flow: column; }
.cbtn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--edge); background: linear-gradient(180deg, #3a7dc4, #1b4a86); color: #fff; font-size: 17px; padding: 0; }
.cbtn.on { background: linear-gradient(180deg, #8ee07a, #3a9a3e); }
.cbtn.lvl { background: rgba(10, 30, 60, 0.8); font-weight: bold; cursor: default; }
#camctl.edit .cbtn.lvl { width: 30px; }

/* ---------- Pie menu ---------- */
#pie { position: absolute; width: 0; height: 0; z-index: 30; }
#pie .center { position: absolute; transform: translate(-50%, -50%); padding: 6px 12px; border-radius: 16px; font-weight: bold; font-size: 14px; white-space: nowrap; background: rgba(12, 40, 80, 0.92); border: 2px solid rgba(200, 235, 255, 0.8); cursor: pointer; }
#pie .opt { position: absolute; transform: translate(-50%, -50%); padding: 7px 13px; border-radius: 18px; font-size: 13px; white-space: nowrap; color: #fff; background: linear-gradient(180deg, #5aa8ea, #2c6fb6); border: 1px solid rgba(200, 235, 255, 0.85); box-shadow: 0 3px 9px rgba(0, 0, 0, 0.45); cursor: pointer; }
#pie .opt:hover { background: linear-gradient(180deg, #8ee07a, #3a9a3e); }
#pie .opt.dis { background: linear-gradient(180deg, #7d8ea2, #4c5c70); color: #d0d8e0; cursor: default; }
#pie .opt.sub::after { content: ' ▸'; }
@keyframes pieIn { from { transform: translate(-50%, -50%) scale(0.75); } to { transform: translate(-50%, -50%) scale(1); } }

#tooltip { position: absolute; z-index: 70; pointer-events: none; padding: 6px 10px; font-size: 12px; max-width: 280px; border-radius: 9px; background: rgba(10, 28, 55, 0.94); border: 1px solid var(--edge); }
#tooltip b { font-size: 13px; }

/* ---------- Modals ---------- */
#modal-wrap { position: absolute; inset: 0; background: rgba(0, 10, 25, 0.45); display: flex; align-items: center; justify-content: center; z-index: 60; }
.modal { min-width: 380px; max-width: 760px; max-height: 84vh; overflow-y: auto; padding: 16px 18px; }
.modal h2 { margin: 0 0 10px; font-size: 20px; }
.modal .row { display: flex; gap: 10px; align-items: center; margin: 7px 0; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.career-card { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.07); margin: 6px 0; }
.career-card .ic { font-size: 28px; text-align: center; }
.career-card small { color: var(--muted); }
.reward-card { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 7px; border-radius: 10px; background: rgba(255, 255, 255, 0.07); margin: 5px 0; }
.reward-card.owned { opacity: 0.55; }

/* ---------- Buy / Build panels ---------- */
#editpanel { position: absolute; left: 290px; bottom: 12px; width: calc(100vw - 360px); max-width: 1100px; height: 216px; display: flex; padding: 8px; gap: 8px; }
#ep-cats { width: 150px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.cat-btn { text-align: left; padding: 5px 8px; border-radius: 8px; border: 1px solid transparent; background: rgba(255, 255, 255, 0.06); color: #fff; font-size: 12px; }
.cat-btn.on { background: linear-gradient(180deg, #8ee07a, #3a9a3e); border-color: #dfffd0; }
#ep-items { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; overflow-y: auto; align-content: start; padding-right: 4px; }
.item-card { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 10px; padding: 4px; text-align: center; cursor: pointer; font-size: 11px; position: relative; }
.item-card:hover { background: rgba(255, 255, 255, 0.16); }
.item-card.on { border-color: #9dff7a; background: rgba(130, 255, 110, 0.18); }
.item-card img { width: 80px; height: 64px; object-fit: contain; display: block; margin: 0 auto; }
.item-card .pr { color: var(--accent); font-weight: bold; }
.item-card .sw { width: 100%; height: 60px; border-radius: 6px; margin-bottom: 2px; background-size: 64px 64px; }
#ep-info { width: 220px; font-size: 12px; overflow-y: auto; }
#ep-info h3 { margin: 2px 0 4px; font-size: 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.swatch { width: 24px; height: 24px; border-radius: 6px; border: 2px solid rgba(255, 255, 255, 0.4); cursor: pointer; }
.swatch.on { border-color: #9dff7a; box-shadow: 0 0 0 2px rgba(130, 255, 110, 0.5); }
.hint { color: var(--muted); font-size: 11px; margin-top: 6px; line-height: 1.35; }

/* ---------- Main menu ---------- */
#mainmenu { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-start; padding-left: 8vw; z-index: 45; background: linear-gradient(90deg, rgba(5, 20, 45, 0.82), rgba(5, 20, 45, 0.15) 60%, rgba(5, 20, 45, 0)); }
#mainmenu .box { width: 360px; }
#mainmenu h1 { font-size: 64px; margin: 0; line-height: 0.95; text-shadow: 0 4px 12px rgba(0, 0, 0, 0.6); letter-spacing: 1px; }
#mainmenu h1 span { color: #8ee07a; }
#mainmenu .plumb { filter: drop-shadow(0 0 12px #6f6); display: block; margin-left: 20px; animation: orbPulse 2.4s ease-in-out infinite; }
@keyframes orbPulse { 0%, 100% { transform: scale(0.92); opacity: 0.9; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes spin { from { transform: rotateY(0); } to { transform: rotateY(360deg); } }
#mainmenu .sub { color: var(--muted); margin: 8px 0 26px; font-size: 16px; }
#mainmenu .btn { display: block; width: 280px; margin: 10px 0; font-size: 18px; padding: 12px; }

/* ---------- CAS ---------- */
#cas { position: absolute; inset: 0; z-index: 42; display: flex; background: radial-gradient(ellipse at 65% 50%, #3d7fb8 0%, #1a3e6a 55%, #0c1e38 100%); }
#cas-left { width: 470px; margin: 16px; padding: 12px; display: flex; flex-direction: column; }
#cas-tabs { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
#cas-tabs .btn { flex: 1; padding: 6px 4px; font-size: 12px; }
#cas-tabs .btn.on { background: linear-gradient(180deg, #8ee07a, #3a9a3e); }
#cas-body { flex: 1; overflow-y: auto; padding-right: 6px; font-size: 13px; }
#cas-body h4 { margin: 10px 0 5px; font-size: 13px; color: #d8ecff; }
#cas-body input[type=text] { width: 100%; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--edge); background: rgba(0, 0, 0, 0.3); color: #fff; font-size: 15px; }
#cas-body input[type=range] { width: 100%; }
#cas-body select { padding: 5px; border-radius: 6px; background: #1e3c64; color: #fff; border: 1px solid var(--edge); }
.opt-row { display: flex; flex-wrap: wrap; gap: 5px; }
.opt-btn { padding: 5px 10px; border-radius: 8px; border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.08); color: #fff; font-size: 12px; }
.opt-btn.on { background: linear-gradient(180deg, #8ee07a, #3a9a3e); border-color: #dfffd0; }
.trait-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.trait-btn { padding: 6px 4px; border-radius: 9px; border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.07); color: #fff; font-size: 11px; text-align: center; }
.trait-btn .e { font-size: 20px; display: block; }
.trait-btn.on { background: linear-gradient(180deg, #8ee07a, #3a9a3e); border-color: #dfffd0; }
.trait-btn.dis { opacity: 0.35; cursor: default; }
#cas-right { flex: 1; position: relative; }
#cas-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#cas-house { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 8px; padding: 8px 12px; align-items: center; }
#cas-house .portrait-btn { width: 60px; height: 60px; }
#cas-top { position: absolute; right: 18px; top: 18px; display: flex; gap: 8px; }
#cas-namebig { position: absolute; left: 50%; top: 74px; transform: translateX(-50%); font-size: 26px; font-weight: bold; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); white-space: nowrap; }
.ltw-card { display: grid; grid-template-columns: 34px 1fr; gap: 8px; padding: 6px; border-radius: 9px; border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.06); margin: 4px 0; cursor: pointer; }
.ltw-card.on { background: rgba(130, 255, 110, 0.2); border-color: #9dff7a; }
.ltw-card .e { font-size: 24px; text-align: center; }

#loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #0d1a2b; z-index: 100; font-size: 20px; flex-direction: column; gap: 10px; }
#loading .bar { width: 260px; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
#loading .bar div { height: 100%; background: #6ad06a; width: 0; transition: width 0.2s; }
#fatal { position: absolute; left: 10px; top: 10px; right: 10px; background: #600; color: #fff; padding: 10px; font: 12px monospace; z-index: 200; white-space: pre-wrap; display: none; }

@media (max-width: 1200px) {
	#simpanel, #wishbar { width: 560px; }
	#editpanel { width: calc(100vw - 310px); }
}
.sew-opts h4 { margin: 8px 0 4px; font-size: 13px; }
.sew-opts .opt-row { gap: 4px; }
.modal .foot.sticky { position: sticky; bottom: -16px; margin: 10px -18px -16px; padding: 10px 18px; background: rgba(14, 44, 86, 0.97); border-top: 1px solid rgba(200, 235, 255, 0.25); }

/* ---------- Minigames ---------- */
#mg-panel { position: absolute; left: 50%; top: 70px; transform: translateX(-50%); width: 470px; padding: 10px 14px 12px; z-index: 25; user-select: none; }
#mg-panel.min .mg-body, #mg-panel.min .mg-foot { display: none; }
.mg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mg-title { font-weight: bold; font-size: 16px; }
.mg-title small { display: block; font-weight: normal; font-size: 12px; color: #a9c3e0; }
.mg-hb { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.1); color: #fff; }
.mg-stats { font-size: 12px; color: #cfe3f7; margin: 4px 0 6px; }
.mg-body { min-height: 150px; }
.mg-foot { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.mg-prompt { font-size: 13px; margin: 2px 0 6px; }
.mg-prompt.big { font-size: 15px; font-weight: bold; min-height: 40px; }
.mg-ticket { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.mg-ticket span { padding: 3px 7px; border-radius: 8px; background: rgba(255, 255, 255, 0.1); font-size: 12px; }
.mg-ticket span.now { background: #e8c547; color: #222; font-weight: bold; }
.mg-ticket span.done { background: #3a9a3e; text-decoration: line-through; opacity: 0.8; }
.mg-timer { height: 7px; border-radius: 4px; background: rgba(0, 0, 0, 0.35); overflow: hidden; margin: 4px 0 8px; }
.mg-timer-fill { height: 100%; width: 100%; transition: width 0.1s linear; }
.mg-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.mg-btn, .mg-pad, .mg-opt, .mg-bin { border-radius: 10px; border: 1px solid rgba(200, 235, 255, 0.5); background: linear-gradient(180deg, #4a8fd4, #24609e); color: #fff; padding: 6px 4px; font-size: 12px; cursor: pointer; }
.mg-btn:hover, .mg-pad:hover, .mg-opt:hover { filter: brightness(1.15); }
.mg-btn .e, .mg-pad .e { display: block; font-size: 22px; }
.mg-big { font-size: 46px; text-align: center; transition: transform 0.2s; }
.mg-track { position: relative; height: 22px; border-radius: 11px; background: rgba(0, 0, 0, 0.4); margin: 6px 0 10px; overflow: hidden; }
.mg-zone { position: absolute; top: 0; bottom: 0; background: rgba(90, 220, 110, 0.75); }
.mg-needle { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; background: #fff; box-shadow: 0 0 6px #fff; }
.mg-go { display: block; margin: 0 auto; min-width: 160px; }
.mg-msg { text-align: center; min-height: 18px; font-size: 13px; color: #ffe68a; margin-top: 4px; }
.mg-item { font-size: 14px; text-align: center; margin: 4px 0; }
.mg-item .e { font-size: 34px; display: block; }
.mg-item .sticker { display: inline-block; width: 18px; height: 18px; border-radius: 4px; vertical-align: middle; margin-right: 6px; border: 2px solid #fff; }
.mg-bins { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mg-bin { font-weight: bold; padding: 12px 4px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.mg-opts { display: grid; grid-template-columns: 1fr; gap: 5px; }
.mg-opt { text-align: left; padding: 8px 10px; font-size: 13px; }
.mg-wires { display: flex; justify-content: center; align-items: center; gap: 30px; }
.mg-col { display: flex; flex-direction: column; gap: 6px; }
.mg-gap { font-size: 26px; opacity: 0.6; }
.mg-plug { width: 46px; height: 30px; border-radius: 15px; border: 3px solid #fff; background: rgba(0, 0, 0, 0.3); color: #fff; font-size: 14px; cursor: pointer; }
.mg-plug.sel { box-shadow: 0 0 0 3px #fff, 0 0 12px #fff; }
.mg-plug.done { opacity: 0.45; }
.mg-word { font-size: 28px; font-weight: bold; text-align: center; letter-spacing: 2px; margin: 6px 0; }
.mg-input { width: 100%; font-size: 18px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--edge); }
.mg-pads { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mg-pad { padding: 12px 4px; }
.mg-pad.lit { background: linear-gradient(180deg, #ffe680, #e8b020); color: #222; transform: scale(1.06); }
.mg-flash { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); background: rgba(160, 30, 30, 0.92); padding: 6px 14px; border-radius: 10px; font-weight: bold; pointer-events: none; animation: mgfade 1.4s forwards; }
.mg-flash.good { background: rgba(40, 140, 60, 0.92); }
@keyframes mgfade { 0% { opacity: 0; } 15% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }

/* the morning paper */
.modal.paper { background: #f3eedf; color: #2a2620; font-family: Georgia, 'Times New Roman', serif; border: 1px solid #b9ae92; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.modal.paper .pp-mast { font-size: 34px; font-weight: bold; text-align: center; letter-spacing: 1px; border-bottom: 3px double #2a2620; padding-bottom: 4px; }
.modal.paper .pp-date { display: flex; justify-content: space-between; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid #2a2620; padding: 3px 0; margin-bottom: 10px; }
.modal.paper .pp-lead { display: flex; gap: 12px; align-items: flex-start; border-bottom: 1px solid #b9ae92; padding-bottom: 10px; margin-bottom: 10px; }
.modal.paper .pp-ic { font-size: 54px; line-height: 1; }
.modal.paper .pp-h1 { font-size: 26px; font-weight: bold; line-height: 1.15; margin-bottom: 5px; }
.modal.paper .pp-cols { column-count: 2; column-gap: 18px; column-rule: 1px solid #b9ae92; }
.modal.paper .pp-story { break-inside: avoid; margin-bottom: 10px; }
.modal.paper .pp-h2 { font-size: 16px; font-weight: bold; line-height: 1.2; margin-bottom: 3px; }
.modal.paper .pp-body { font-size: 13px; line-height: 1.4; }
.modal.paper .btn { font-family: sans-serif; }
.trait-chip.quirk { background: rgba(160, 90, 200, 0.35); }
