/*
 * ui/game-skin.css — "real game" skin (v0.9). Loaded after theme.css and overrides it.
 *
 * Goals: no web-page feel. Floating HUD instead of a white header bar, framed windows (parchment +
 * gold trim + wooden edge) instead of scrolling pages, beveled game buttons, wooden tabs, painted
 * icons, a heavy rounded title font with outlines, no text selection / dragging, smooth fades.
 */
:root {
  --serif: 'Trebuchet MS', 'Microsoft YaHei UI', 'Microsoft YaHei', 'PingFang SC', system-ui, sans-serif;
  --wood: #8a5a32; --wood-dark: #4a2c17; --wood-light: #c58d55;
  --trim: #e9c48a; --trim-bright: #ffe7a8;
  --parchment: #fff8e6; --parchment-2: #f6e8c8;
  --hud: rgba(26, 30, 52, .78);
}

/* ---------------------------------------------------------------- global feel */
html, body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
input, textarea { -webkit-user-select: text; user-select: text; }
img, svg, canvas { -webkit-user-drag: none; user-select: none; }
body {
  background:
    radial-gradient(ellipse 40% 12% at 18% 22%, #ffffffcc, transparent 70%),
    radial-gradient(ellipse 30% 10% at 78% 14%, #ffffffb0, transparent 70%),
    radial-gradient(ellipse 80% 30% at 50% 108%, #7ccf54 60%, transparent 61%),
    radial-gradient(ellipse 60% 26% at 10% 104%, #5fae4f 60%, transparent 61%),
    linear-gradient(#7cc8ff, #cdeeff 70%, #eefaff);
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M3 2 L3 22 L8.5 17 L12 25 L15.5 23.5 L12 15.8 L19.5 15.5 Z' fill='%23ffe08a' stroke='%234a2c17' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M5.5 6 L5.5 15' stroke='%23fff' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") 3 2, auto;
}
button, a, [data-action] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M3 2 L3 22 L8.5 17 L12 25 L15.5 23.5 L12 15.8 L19.5 15.5 Z' fill='%23ffffff' stroke='%23c18a24' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") 3 2, pointer; }
h1, h2, h3, .v3-panel-head h1 { font-family: var(--serif); font-weight: 900; letter-spacing: .5px; }
#app > * { animation: screen-in .28s ease-out; }
#app.rerender > *, #app.rerender .v3-screen, #app.rerender .modal-panel { animation: none !important; }
@keyframes screen-in { from { opacity: 0; } }
.gi { display: block; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .18)); }

/* ---------------------------------------------------------------- floating HUD (top) */
.topbar, .v3-topbar { background: none !important; border: 0 !important; box-shadow: none !important; backdrop-filter: none !important; pointer-events: none; height: 64px; padding: 0 14px; }
.topbar > * { pointer-events: auto; }
.v3-account { background: var(--hud); border: 2px solid var(--trim); box-shadow: 0 3px 0 rgba(0, 0, 0, .35), inset 0 1px 0 #ffffff22; padding: 3px 18px 3px 3px; }
.v3-account-avatar { border: 3px solid var(--trim-bright); box-shadow: 0 0 0 2px var(--wood-dark); }
.v3-account-avatar em { background: linear-gradient(#ffd86a, #e8a21a); color: #4a2c17; border: 2px solid var(--wood-dark); font-weight: 900; }
.v3-account-info strong { color: #fff; text-shadow: 0 1px 2px #000; }
.v3-account-info small { color: #ffe7a8; }
.v3-account-info .v3-bar { background: #00000055; border: 1px solid #ffffff33; }
.v3-currency { background: var(--hud); color: #fff; border: 2px solid var(--trim); box-shadow: 0 3px 0 rgba(0, 0, 0, .35); padding: 3px 12px 3px 4px; text-shadow: 0 1px 2px #000; font-weight: 800; }
.v3-currency i { background: none; width: 26px; height: 26px; }
.v3-currency em { border: 2px solid #1f6a3a; }
.round-button, .language-button { background: var(--hud); color: #fff; border: 2px solid var(--trim); box-shadow: 0 3px 0 rgba(0, 0, 0, .35); border-radius: 50%; width: 42px; height: 42px; padding: 0; display: inline-grid; place-items: center; font-weight: 800; }
.language-button { border-radius: 14px; width: auto; padding: 0 10px; }
.round-button .gi { width: 26px; height: 26px; }

/* ---------------------------------------------------------------- dock & rail (wooden) */
.v3-dock { background: linear-gradient(#c58d55, #8a5a32); border: 3px solid var(--trim); box-shadow: 0 5px 0 var(--wood-dark), 0 12px 24px rgba(0, 0, 0, .3), inset 0 2px 0 #ffffff33; border-radius: 22px; padding: 7px; gap: 6px; backdrop-filter: none; }
.dock-btn { width: 74px; height: 74px; border-radius: 16px; background: linear-gradient(#fff8e6, #f0dcb4); border: 2px solid var(--wood-dark); box-shadow: inset 0 -4px 0 #d9bc86, inset 0 2px 0 #fff; }
.dock-btn:hover { transform: translateY(-3px); box-shadow: inset 0 -4px 0 #d9bc86, inset 0 2px 0 #fff, 0 0 14px #ffe08a; }
.dock-btn b { display: grid; place-items: center; height: 40px; font-size: 0; }
.dock-btn b .gi { width: 40px; height: 40px; }
.dock-btn span { font-weight: 900; font-size: 11.5px; color: #5a3a1a; letter-spacing: .5px; }
.v3-rail-btn { background: radial-gradient(circle at 50% 35%, #fff8e6, #f0dcb4); border: 3px solid var(--wood-dark); box-shadow: 0 4px 0 var(--wood-dark), 0 8px 16px rgba(0, 0, 0, .25); border-radius: 50%; width: 64px; height: 64px; }
.v3-rail-btn b { display: grid; place-items: center; height: 34px; }
.v3-rail-btn span { position: absolute; bottom: -10px; padding: 1px 7px; border-radius: 8px; background: var(--wood-dark); color: #fff3d6; font-size: 10px; white-space: nowrap; }
.v3-dot { border: 2px solid #fff; box-shadow: 0 2px 0 #7a1a1a; font-weight: 900; }

/* ---------------------------------------------------------------- framed windows (secondary screens) */
.v3-screen, .create-screen.player-screen {
  position: absolute; inset: 72px clamp(8px, 2.4vw, 40px) 14px; height: auto; padding: 78px clamp(14px, 2.4vw, 34px) 26px;
  background:
    radial-gradient(ellipse at 50% 0, #ffffff 0, transparent 60%),
    linear-gradient(var(--parchment), var(--parchment-2));
  border-radius: 26px; border: 4px solid var(--trim);
  box-shadow: 0 0 0 5px var(--wood), 0 0 0 8px var(--wood-dark), 0 14px 0 8px rgba(0, 0, 0, .18), 0 24px 60px rgba(20, 30, 60, .45), inset 0 0 0 2px #fff9;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--wood) transparent;
}
.v3-screen::after, .v3-screen::before { display: none; }
.v3-screen::-webkit-scrollbar { width: 10px; }
.v3-screen::-webkit-scrollbar-thumb { background: var(--wood); border-radius: 6px; border: 2px solid var(--parchment); }
/* title ribbon */
.v3-panel-head { position: absolute; top: 10px; left: 0; right: 0; margin: 0; display: flex; justify-content: center; z-index: 5; pointer-events: none; }
.v3-panel-head > div { position: relative; padding: 8px 56px 10px; text-align: center; background: linear-gradient(#d9534f, #a8352c); border: 3px solid var(--trim); border-radius: 12px; box-shadow: 0 4px 0 #6a1f1a, 0 8px 16px rgba(0, 0, 0, .25); }
.v3-panel-head > div::before, .v3-panel-head > div::after { content: ''; position: absolute; top: 12px; width: 34px; height: 100%; background: #8a2a24; z-index: -1; }
.v3-panel-head > div::before { left: -26px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 30% 50%); }
.v3-panel-head > div::after { right: -26px; clip-path: polygon(0 0, 100% 0, 70% 50%, 100% 100%, 0 100%); }
.v3-panel-head .eyebrow { display: none; }
.v3-panel-head h1 { margin: 0; font-size: clamp(22px, 2.4vw, 30px); color: #fff3d6; white-space: nowrap; text-shadow: 0 2px 0 #6a1f1a, 0 0 12px #ffb0a0; -webkit-text-stroke: .5px #6a1f1a; }
.v3-panel-head p { display: none; }
.v3-back { position: fixed; z-index: 30; pointer-events: auto; top: 50px; right: calc(clamp(8px, 2.4vw, 40px) - 16px); padding: 0; background: none; box-shadow: none; border-radius: 50%; transition: transform .15s; }
.v3-back:hover { transform: scale(1.08) rotate(6deg); }
/* the hero page and others that reuse create-screen */
.create-screen.player-screen .v3-panel-head { top: 0; }

/* ---------------------------------------------------------------- buttons */
.button { border-radius: 14px; font-weight: 900; letter-spacing: .8px; }
.button.gold { background: linear-gradient(#ffe08a, #f2b13a 55%, #d98e1a); border: 2px solid #fff3c4; box-shadow: 0 0 0 2px #8a5200, 0 5px 0 2px #8a5200, 0 10px 16px rgba(120, 70, 0, .3); text-shadow: 0 2px 0 #8a5200; color: #fff; }
.button.gold:not(:disabled):active { transform: translateY(3px); box-shadow: 0 0 0 2px #8a5200, 0 2px 0 2px #8a5200; }
.button.glass { background: linear-gradient(#ffffff, #dfeeff); color: #1e3a6a; border: 2px solid #fff; box-shadow: 0 0 0 2px #3a5ba8, 0 4px 0 2px #3a5ba8; }
.button.danger { border: 2px solid #ffd0c8; box-shadow: 0 0 0 2px #7a1a1a, 0 4px 0 2px #7a1a1a; }
.button:disabled { filter: grayscale(.7) brightness(.95); opacity: .75; }

/* ---------------------------------------------------------------- tabs (wooden) */
.v3-tabs { background: linear-gradient(#8a5a32, #6b4426); border: 2px solid var(--trim); box-shadow: 0 3px 0 var(--wood-dark); padding: 5px; border-radius: 14px; }
.v3-tabs button { color: #fff3d6; font-weight: 800; text-shadow: 0 1px 0 #000; }
.v3-tabs button.active { background: linear-gradient(#ffe08a, #f2b13a); color: #5a3400; text-shadow: none; box-shadow: inset 0 -3px 0 #c18a24, 0 0 0 2px #fff3c4; }
.v3-tabs .wd-link { background: linear-gradient(#ffe6f0, #e8dcff); text-shadow: none; }

/* ---------------------------------------------------------------- cards inside windows */
.hero-card, .v3-product, .wd-item, .v3-mode-card, .quest-row, .skill-row, .slot-card, .class-card { border-color: #ecd9b0 !important; box-shadow: 0 3px 0 #d9bc86, 0 6px 14px rgba(120, 80, 30, .12) !important; }
.wd-stats div, .wd-slot { box-shadow: 0 2px 0 #d9bc86; border: 1px solid #ecd9b0; }
.wd-podium { border-color: var(--trim); box-shadow: 0 0 0 3px var(--wood), 0 8px 18px rgba(0, 0, 0, .2); }
.wd-detail { background: #fffdf3f2; }

/* ---------------------------------------------------------------- modals */
.modal-backdrop { background: rgba(14, 18, 36, .55); backdrop-filter: blur(3px); }
.modal-panel { background: linear-gradient(var(--parchment), var(--parchment-2)); border: 4px solid var(--trim); border-top-width: 4px; border-radius: 24px; box-shadow: 0 0 0 5px var(--wood), 0 0 0 8px var(--wood-dark), 0 30px 70px rgba(0, 0, 0, .45); }
.modal-close { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(#ff8a7a, #c0392b) !important; color: #fff !important; border: 2px solid #fff; box-shadow: 0 0 0 2px #6a1f1a, 0 3px 0 2px #6a1f1a; font-weight: 900; }
#toast { background: var(--hud); border: 2px solid var(--trim); color: #fff; font-weight: 700; text-shadow: 0 1px 2px #000; }

/* ---------------------------------------------------------------- map & town bits */
.map-node .node-caption { background: var(--hud); color: #fff; border: 2px solid var(--trim); }
.map-node .node-caption small { color: #ffe08a; }
.map-node .node-caption strong { color: #fff; }
.v3-map-current { background: linear-gradient(var(--parchment), var(--parchment-2)) !important; border: 3px solid var(--trim); box-shadow: 0 0 0 4px var(--wood), 0 0 0 6px var(--wood-dark), 0 14px 30px rgba(0, 0, 0, .3) !important; }
.world-title { display: none; }
.map-progress { background: var(--hud); border: 2px solid var(--trim); color: #fff; }
.map-progress small { color: #ffe08a; }
.map-progress strong { color: #fff; }

/* ---------------------------------------------------------------- boot / loading screen */
#boot { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(ellipse at 50% 38%, #fff6dc 0, #bfe6ff 45%, #5fb0ef 100%); transition: opacity .5s; }
#boot.done { opacity: 0; pointer-events: none; }
#boot .boot-logo { font: 900 clamp(34px, 6vw, 64px)/1.1 var(--serif); color: #fff; letter-spacing: 4px; text-align: center; text-shadow: 0 4px 0 #c18a24, 0 8px 0 #8a5200, 0 14px 24px rgba(0, 0, 0, .25); -webkit-text-stroke: 2px #8a5200; }
#boot .boot-logo small { display: block; margin-top: 6px; font-size: clamp(12px, 1.6vw, 16px); letter-spacing: 8px; -webkit-text-stroke: 0; color: #8a5200; text-shadow: none; }
#boot .boot-bar { width: min(460px, 78vw); height: 22px; padding: 3px; border-radius: 14px; background: var(--wood-dark); border: 3px solid var(--trim); box-shadow: 0 4px 0 #2a1808; }
#boot .boot-bar i { display: block; height: 100%; width: 0; border-radius: 9px; background: linear-gradient(#fff1a8, #f2b13a); box-shadow: inset 0 -3px 0 #c18a24; transition: width .2s; }
#boot .boot-tip { font-weight: 700; color: #1e3a6a; background: #ffffffb0; padding: 6px 16px; border-radius: 12px; }
#boot .boot-star { font-size: 60px; color: #ffd86a; text-shadow: 0 0 24px #fff; animation: twinkle 2s ease-in-out infinite; }

@media (max-width: 760px) {
  .v3-screen, .create-screen.player-screen { inset: 64px 6px 8px; padding: 54px 10px 18px; }
  .v3-back { top: 44px; right: -4px; }
  .v3-back .gi { width: 38px; height: 38px; }
  .dock-btn { width: 58px; height: 62px; }
  .dock-btn b .gi { width: 32px; height: 32px; }
  .v3-account-info { min-width: 0; }
  .v3-account-info small, .v3-account-info .v3-bar { display: none; }
}

/* ---------------------------------------------------------------- generic ribbon title */
.ribbon { position: relative; padding: 8px 56px 10px; text-align: center; background: linear-gradient(#d9534f, #a8352c); border: 3px solid var(--trim); border-radius: 12px; box-shadow: 0 4px 0 #6a1f1a, 0 8px 16px rgba(0, 0, 0, .25); }
.ribbon::before, .ribbon::after { content: ''; position: absolute; top: 12px; width: 34px; height: 100%; background: #8a2a24; z-index: -1; }
.ribbon::before { left: -26px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 30% 50%); }
.ribbon::after { right: -26px; clip-path: polygon(0 0, 100% 0, 70% 50%, 100% 100%, 0 100%); }
.ribbon h1 { margin: 0; font-size: clamp(22px, 2.6vw, 32px); color: #fff3d6; white-space: nowrap; text-shadow: 0 2px 0 #6a1f1a; }

/* ---------------------------------------------------------------- create character */
.create-screen { background: none; }
.create-sky { display: none; }
.create-head { justify-content: center; position: relative; margin-bottom: 22px; isolation: isolate; }
.create-head > div { flex: 0 0 auto; }
.create-head .language-button { position: absolute; left: 0; top: 4px; }
.create-close { position: absolute !important; right: 0; top: -2px; }
.create-preview { border: 4px solid var(--trim); box-shadow: 0 0 0 5px var(--wood), 0 0 0 8px var(--wood-dark), 0 18px 40px rgba(0, 0, 0, .3); background: radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--cls) 26%, #fff), #fff6dc 55%, #dcefff); }
.create-preview::before { content: ''; position: absolute; inset: 0; background: repeating-conic-gradient(from 0deg at 50% 86%, rgba(255, 214, 106, .16) 0 8deg, transparent 8deg 20deg); }
.preview-name strong { display: inline-block; padding: 2px 18px; border-radius: 10px; background: var(--hud); color: #ffe08a; border: 2px solid var(--trim); font-size: 22px; }
.preview-name small { display: block; margin-top: 4px; color: #5a3a1a; font-weight: 800; }
.create-panel { background: linear-gradient(var(--parchment), var(--parchment-2)); border: 4px solid var(--trim); box-shadow: 0 0 0 5px var(--wood), 0 0 0 8px var(--wood-dark), 0 18px 40px rgba(0, 0, 0, .3); backdrop-filter: none; }
.step-n { background: radial-gradient(circle at 40% 35%, #fff1a8, #e8a21a); color: #5a3400; border: 2px solid var(--wood-dark); box-shadow: 0 2px 0 var(--wood-dark); font-weight: 900; }
.step h2 { color: #5a3a1a; }
.class-card { background: linear-gradient(#fffdf6, #f6e8c8); border: 3px solid #ecd9b0; }
.class-card.selected { border-color: var(--gold) !important; background: linear-gradient(#fff6d6, #ffe7a8); box-shadow: 0 0 0 3px #fff3c4, 0 0 18px #ffd06a, 0 4px 0 #c18a24 !important; transform: translateY(-3px); }
.create-panel .class-detail, .create-panel .v3-class-detail { background: #fffdf6; }
.name-row input { border: 3px solid var(--trim); border-radius: 12px; background: #fffdf6; font-weight: 800; box-shadow: inset 0 2px 4px #0001; }

/* ---------------------------------------------------------------- result screen */
.modal-panel.v3-result { width: min(560px, 94vw); padding-top: 56px; overflow: visible; text-align: center; }
.res-banner { position: absolute; left: 50%; top: -30px; transform: translateX(-50%); padding: 6px 56px 10px; border-radius: 14px; font: 900 clamp(30px, 5vw, 44px)/1 var(--serif); letter-spacing: 4px; color: #fff; -webkit-text-stroke: 1.5px #8a5200; text-shadow: 0 3px 0 #8a5200, 0 0 22px #fff3b0; background: linear-gradient(#ffe08a, #f2a81d); border: 3px solid #fff3c4; box-shadow: 0 0 0 3px #8a5200, 0 6px 0 3px #8a5200, 0 12px 26px rgba(0, 0, 0, .3); animation: res-drop .5s cubic-bezier(.2, 1.6, .4, 1) both; white-space: nowrap; }
.res-banner.lose { background: linear-gradient(#b9c6d6, #6d7a93); -webkit-text-stroke-color: #2a3450; text-shadow: 0 3px 0 #2a3450; box-shadow: 0 0 0 3px #2a3450, 0 6px 0 3px #2a3450; }
@keyframes res-drop { from { transform: translate(-50%, -40px) scale(1.4); opacity: 0; } }
.res-stars { display: flex; justify-content: center; align-items: flex-end; gap: 6px; margin: 6px 0 4px; }
.res-stars span { animation: star-pop .45s cubic-bezier(.2, 1.8, .4, 1) both; }
.res-stars span:nth-child(2) { transform: translateY(-8px); }
@keyframes star-pop { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
.res-star-notes { display: flex; justify-content: center; gap: 12px; font-size: 11px; font-weight: 800; color: #b0a080; }
.res-star-notes .ok { color: #2fa86a; }
.res-title { margin: 10px 0 2px; color: #5a3a1a; }
.res-loot { margin: 14px auto 6px; padding: 12px; border-radius: 16px; background: #fffdf6; border: 2px solid #ecd9b0; box-shadow: inset 0 2px 6px #0000000d; }
.res-loot-title { margin-bottom: 8px; font: 900 11px var(--sans); letter-spacing: 3px; color: var(--gold-deep); }
.v3-rewards { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.v3-rewards > span { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 76px; padding: 8px 6px 6px; border-radius: 14px; background: linear-gradient(#fffdf6, #f6e8c8); border: 2px solid #e2c48e; box-shadow: 0 3px 0 #d9bc86; animation: star-pop .35s ease-out both; }
.v3-rewards > span b { display: grid; place-items: center; height: 32px; font-size: 22px; }
.v3-rewards > span strong { font-size: 15px; color: #5a3a1a; }
.v3-rewards > span small { font-size: 10px; color: #8a7a60; font-weight: 700; }
.v3-rewards > span:nth-child(2) { animation-delay: .08s; } .v3-rewards > span:nth-child(3) { animation-delay: .16s; } .v3-rewards > span:nth-child(4) { animation-delay: .24s; } .v3-rewards > span:nth-child(5) { animation-delay: .32s; } .v3-rewards > span:nth-child(6) { animation-delay: .4s; }
.node-stars { font-style: normal; color: #ffd24d; letter-spacing: 0; text-shadow: 0 1px 1px #000; }

/* ---------------------------------------------------------------- NPC dialogue */
.modal-panel.npc-modal { width: min(720px, 96vw); padding: 18px 20px 18px 18px; }
.npc-dlg { display: flex; gap: 18px; align-items: stretch; }
.npc-face { flex: 0 0 150px; height: 150px; border-radius: 18px; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 40%, #fff, #ffe7a8 60%, #e9c48a); border: 3px solid var(--trim); box-shadow: 0 0 0 3px var(--wood), inset 0 -10px 20px #c18a2433; }
.npc-face img { width: 100%; height: 100%; object-fit: contain; }
.npc-body { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.npc-name { align-self: flex-start; padding: 3px 14px; border-radius: 10px; background: linear-gradient(#c58d55, #8a5a32); color: #fff3d6; font-weight: 900; border: 2px solid var(--trim); box-shadow: 0 2px 0 var(--wood-dark); }
.npc-text { flex: 1; min-height: 56px; margin: 0; padding: 12px 14px; border-radius: 14px; background: #fffdf6; border: 2px solid #ecd9b0; font-size: 16px; font-weight: 600; color: #3a2a1e; line-height: 1.6; }
.npc-gift .v3-rewards { justify-content: flex-start; }
.npc-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.npc-opts .button { min-height: 40px; padding: 6px 16px; }
@media (max-width: 600px) { .npc-dlg { flex-direction: column; align-items: center; } .npc-face { flex-basis: auto; width: 110px; height: 110px; } }

/* ---------------------------------------------------------------- story cutscenes */
.cutscene { position: fixed; inset: 0; z-index: 80; opacity: 0; transition: opacity .3s; cursor: pointer; }
.cutscene.on { opacity: 1; } .cutscene.out { opacity: 0; }
.cs-dim { position: absolute; inset: 0; background: linear-gradient(rgba(10, 14, 30, .25), rgba(10, 14, 30, .7)); }
.cs-bars::before, .cs-bars::after { content: ''; position: absolute; left: 0; right: 0; height: 7vh; background: #0b0d18; transition: transform .4s; }
.cs-bars::before { top: 0; } .cs-bars::after { bottom: 0; }
.cs-portrait { position: absolute; bottom: 150px; width: min(420px, 38vw); aspect-ratio: 1; object-fit: contain; filter: brightness(.55) saturate(.7) drop-shadow(0 10px 20px rgba(0, 0, 0, .4)); transition: filter .25s, transform .25s; opacity: 0; }
.cs-portrait.left { left: 4vw; } .cs-portrait.right { right: 4vw; transform: scaleX(-1); }
.cs-portrait.in { animation: cs-in-l .35s ease-out forwards; } .cs-portrait.right.in { animation-name: cs-in-r; }
.cs-portrait.active { filter: brightness(1) drop-shadow(0 10px 24px rgba(0, 0, 0, .45)); }
.cs-portrait.left.active { transform: scale(1.04); } .cs-portrait.right.active { transform: scaleX(-1) scale(1.04); }
.cs-portrait.boss.active { filter: brightness(1) drop-shadow(0 0 24px #ff5a5a); }
@keyframes cs-in-l { from { opacity: 0; translate: -60px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes cs-in-r { from { opacity: 0; translate: 60px 0; } to { opacity: 1; translate: 0 0; } }
.cs-box { position: absolute; left: 50%; bottom: calc(7vh + 14px); transform: translateX(-50%); width: min(980px, 94vw); min-height: 128px; padding: 26px 30px 22px; border-radius: 22px; background: linear-gradient(rgba(255, 250, 236, .97), rgba(246, 232, 200, .97)); border: 4px solid var(--trim); box-shadow: 0 0 0 5px var(--wood), 0 0 0 8px var(--wood-dark), 0 20px 50px rgba(0, 0, 0, .45); }
.cs-name { position: absolute; top: -20px; left: 26px; padding: 4px 18px; border-radius: 12px; background: var(--c, #8a5a32); color: #fff; font: 900 17px var(--serif); border: 3px solid var(--trim); box-shadow: 0 3px 0 rgba(0, 0, 0, .35); text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.cs-text { margin: 0; font-size: clamp(16px, 1.6vw, 20px); line-height: 1.7; font-weight: 700; color: #3a2a1e; min-height: 3.4em; }
.cutscene.narration .cs-text { text-align: center; font-style: italic; color: #5a4a3a; }
.cs-next { position: absolute; right: 24px; bottom: 12px; color: var(--gold-deep); font-size: 18px; animation: cs-bob .8s ease-in-out infinite; }
@keyframes cs-bob { 50% { transform: translateY(4px); } }
.cs-skip { position: absolute; top: calc(7vh + 14px); right: 20px; padding: 8px 16px; border-radius: 12px; background: var(--hud); color: #fff; border: 2px solid var(--trim); font-weight: 800; }
@media (max-width: 760px) { .cs-portrait { width: 52vw; bottom: 170px; } .cs-box { padding: 22px 16px 18px; } }

/* ---------------------------------------------------------------- v0.16 card grades: 白 蓝 橙 金 传说 */
:root { --g0: #b9c0cc; --g1: #3d8ef0; --g2: #ff8a2b; --g3: #f5c542; --g4: #ff4d6d; }
.rarity.white { color: #8a93a3; } .rarity.blue { color: var(--g1); } .rarity.s { color: var(--g2); } .rarity.ss { color: #e0a61a; }
.rarity.sss { background: linear-gradient(90deg, #ff4d6d, #ffb347, #ffe066, #ff4d6d); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: legend-shift 3s linear infinite; }
@keyframes legend-shift { to { background-position: 200% 0; } }
.grade-tag { font-style: normal; font-weight: 900; padding: 1px 8px; border-radius: 8px; background: rgba(20, 16, 30, .72); }
.grade-card { --gc: var(--g0); border-color: var(--gc) !important; box-shadow: 0 0 0 2px var(--gc), 0 6px 18px rgba(0, 0, 0, .25) !important; }
.grade-card.blue { --gc: var(--g1); } .grade-card.s { --gc: var(--g2); } .grade-card.ss { --gc: var(--g3); box-shadow: 0 0 0 2px var(--gc), 0 0 18px #f5c54288 !important; }
.grade-card.sss { --gc: var(--g4); box-shadow: 0 0 0 2px #ffb347, 0 0 24px #ff4d6d99 !important; }
.grade-card .portrait { box-shadow: inset 0 -40px 40px -20px color-mix(in srgb, var(--gc) 55%, transparent); }
.grade-pips { display: inline-flex; gap: 3px; margin: 2px 0; }
.grade-pips i { width: 10px; height: 10px; transform: rotate(45deg); border-radius: 2px; background: #d6dbe5; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.grade-pips i.on.white { background: var(--g0); } .grade-pips i.on.blue { background: var(--g1); } .grade-pips i.on.s { background: var(--g2); }
.grade-pips i.on.ss { background: var(--g3); } .grade-pips i.on.sss { background: linear-gradient(135deg, #ff4d6d, #ffe066); }
.v3-potential { font-size: 12px; color: var(--muted); margin-left: 6px; }
/* fusion altar */
.v3-fusion .grade-tabs button { flex-direction: row; gap: 6px; align-items: center; }
.v3-fusion .grade-tabs small { margin-left: 6px; }
.v3-fusion .v3-altar { display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; padding: 18px; border-radius: 18px; background: linear-gradient(160deg, rgba(40, 30, 60, .9), rgba(20, 16, 34, .92)); color: #f3ead8; box-shadow: inset 0 0 0 2px rgba(232, 181, 74, .4); }
.v3-fusion .altar-slots { display: flex; align-items: center; gap: 10px; }
.v3-fusion .altar-slot, .v3-fusion .altar-result { position: relative; inset: auto; transform: none; width: 104px; height: 136px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: rgba(255, 255, 255, .06); border: 2px dashed rgba(232, 181, 74, .55); color: #e8d9b8; overflow: hidden; padding: 0; }
.v3-fusion .altar-slot.main { border-color: #ffd86a; }
.v3-fusion .altar-slot.filled, .v3-fusion .altar-result.grade-card { border-style: solid; background: rgba(0, 0, 0, .3); cursor: pointer; }
.v3-fusion .altar-slot .portrait, .v3-fusion .altar-result .portrait { width: 100%; height: 100px; }
.v3-fusion .altar-slot .card-rarity, .v3-fusion .altar-result .card-rarity { position: absolute; top: 4px; left: 4px; }
.v3-fusion .altar-slot small, .v3-fusion .altar-result small { font-size: 11px; font-weight: 800; }
.v3-fusion .altar-slot span { font-weight: 900; font-size: 15px; }
.v3-fusion .altar-result b { font-size: 44px; color: #ffd86a; }
.v3-fusion .altar-plus, .v3-fusion .altar-arrow { font: 900 24px var(--serif); color: #ffd86a; }
.v3-fusion .altar-copy p { margin: 0 0 14px; line-height: 1.6; font-size: 14px; color: #e6dcc6; }
.v3-fusion .altar-actions { display: flex; gap: 10px; }
.v3-fusion .altar-pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 16px; }
.v3-fusion .pool-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border-radius: 14px; background: #fffaf0; box-shadow: 0 2px 0 rgba(0, 0, 0, .1); }
.v3-fusion .pool-hero .portrait { width: 84px; height: 84px; border-radius: 12px; }
.v3-fusion .pool-hero strong { font-size: 13px; }
.v3-fusion .pool-hero .mini { width: 100%; padding: 5px 6px; border-radius: 9px; font-weight: 800; font-size: 12px; background: linear-gradient(#ffd86a, #e8a93a); color: #4a2c0a; border: 0; box-shadow: 0 2px 0 #a86a00; }
.v3-fusion .pool-hero .mini.off { background: #e5e0d6; color: #9a9080; box-shadow: none; }
@media (max-width: 760px) { .v3-fusion .v3-altar { grid-template-columns: 1fr; } .v3-fusion .altar-slot, .v3-fusion .altar-result { width: 74px; height: 104px; } .v3-fusion .altar-slot .portrait, .v3-fusion .altar-result .portrait { height: 72px; } }
/* protagonist look templates */
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; margin: 12px 0; }
.avatar-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border-radius: 14px; background: #fffaf0; border: 3px solid transparent; box-shadow: 0 2px 0 rgba(0, 0, 0, .12); }
.avatar-pick img { width: 78px; height: 78px; object-fit: cover; border-radius: 10px; }
.avatar-pick small { font-size: 11px; font-weight: 800; text-align: center; line-height: 1.2; }
.avatar-pick.on { border-color: #e8a93a; box-shadow: 0 0 0 2px #ffd86a, 0 4px 12px rgba(232, 169, 58, .45); }
.avatar-default { width: 78px; height: 78px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(160deg, #3a2f55, #1c1830); color: #ffd86a; font-size: 30px; }
.rarity.grade-tag { color: #fff; -webkit-text-fill-color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .45); background: var(--g0); animation: none; }
.rarity.grade-tag.white { background: #8f98a8; } .rarity.grade-tag.blue { background: var(--g1); } .rarity.grade-tag.s { background: var(--g2); }
.rarity.grade-tag.ss { background: linear-gradient(135deg, #f8d460, #d99a14); }
.rarity.grade-tag.sss { background: linear-gradient(90deg, #ff4d6d, #ff9a3c, #ffcf40, #ff4d6d); background-size: 200% 100%; animation: legend-shift 3s linear infinite; }
