@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL,GRAD@20,700,0,0');
@font-face { font-family: 'Pixelify Sans'; src: url('../assets/fonts/pixelify-sans.woff2') format('woff2'); font-style: normal; font-weight: 400 700; font-display: swap; }
@property --bot-color { syntax: '<color>'; inherits: true; initial-value: #00d9ff; }
@keyframes botcolor { from { --bot-color: #00d9ff; } to { --bot-color: #00ff88; } }
:root { color-scheme: dark; font-family: 'Segoe UI', sans-serif; color: #eee9e0; background: #0b0b14; --gold: #d6c2a1; --line: #ffffff14; --brightness: 1; --dialogue-font: 'Pixelify Sans', monospace; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; min-height: 100svh; background: radial-gradient(ellipse at 52% 30%, #1c1c30, #10101c 48%, #0a0a12); }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; border: 0; transition: background .2s, color .2s, opacity .2s; }
button, a { touch-action: manipulation; }
button:disabled { cursor: wait; opacity: .6; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 5px; }
[hidden] { display: none !important; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.game-shell { position: relative; width: 100%; min-height: 100svh; margin: 0; padding: 0; display: flex; flex-direction: column; --chrome-height: 0px; }
.icon-button { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border-radius: 6px; color: #a5a2af; }
.icon-button:hover { background: #ffffff0a; color: #fff3dd; }
.stage { position: relative; width: min(100%, calc((100svh - var(--chrome-height)) * 1672 / 941)); aspect-ratio: 1672 / 941; align-self: center; flex-shrink: 0; margin: auto 0; overflow: hidden; border: 0; border-radius: 0; background: #090914; outline: none; }
.scene { position: absolute; inset: 0; filter: brightness(var(--brightness)); }
.background, .ground { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.background { object-fit: contain; }
.ground, .berin { pointer-events: none; }
.berin { position: absolute; display: block; }
#berin-fallback { background: url('../assets/characters/berin/berin-spritesheet.png') no-repeat 0 0 / 500% 200%; }
#berin-canvas { visibility: hidden; }
.scene-vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 70px #06051133; }
.main-menu { position: absolute; inset: 0; display: flex; align-items: center; background: linear-gradient(90deg, #0c0c1aee, #0e0d1edb 20%, #100e2080 43%, #0c0b1a15 67%, transparent); font-family: var(--dialogue-font); }
.menu-content { margin: 0 6.5%; padding: 20px 0; }
.eyebrow { font-size: 10px; font-weight: 500; letter-spacing: 2.6px; color: #c0b4aa; }
h1 { font: normal clamp(48px, 5.3vw, 82px)/1.1 var(--dialogue-font); letter-spacing: -2.5px; margin: 0 0 2px; color: #f1e9da; text-shadow: 0 2px 20px #0003; }
.menu-subtitle { color: #b7b0bc; font-size: 13px; line-height: 1.8; margin: 0; }
.menu-actions { margin-top: 36px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.primary-button { min-height: 46px; min-width: 204px; display: flex; justify-content: space-between; align-items: center; gap: 36px; padding: 12px 19px; background: #d8c5a9; color: #262127; border: 1px solid #e7d3b6; border-radius: 4px; font-size: 13px; font-weight: 600; }
.primary-button:hover:not(:disabled) { background: #ebd7b8; }
.primary-button .icon { width: 17px; height: 17px; }
.text-button { min-height: 40px; background: none; color: #c7bcc4; font-size: 12px; padding: 9px 0; }
.text-button:hover { color: #f2dcc1; }
.menu-actions .text-button { min-width: 204px; text-align: left; padding-left: 19px; }
.menu-note { display: block; margin-top: 24px; color: #918998; font-size: 10px; letter-spacing: .4px; }
.scene-corner { position: absolute; bottom: 18px; right: 23px; color: #e1cbae90; font-size: 20px; }
kbd { font: 10px 'Segoe UI', sans-serif; display: inline-flex; align-items: center; justify-content: center; min-width: 23px; height: 22px; padding: 1px 5px; border: 1px solid #ffffff1b; border-radius: 4px; color: #aaa2b2; }
body[data-mode="menu"] .play-only { display: none; }
body[data-dialogue="true"] .scene-corner { visibility: hidden; }
.panel { padding: 28px 30px; width: min(440px, calc(100% - 32px)); max-height: calc(100svh - 48px); overflow-y: auto; color: #e9e1d8; background: #15141ff7; border: 1px solid #b5a6c230; border-radius: 10px; box-shadow: 0 30px 100px #0009; scrollbar-width: thin; }
.panel::backdrop { background: #0706109c; backdrop-filter: blur(6px); }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.panel-heading .icon-button { margin: -8px -12px 0 0; }
.panel h2 { font: normal 32px/1.2 Georgia, serif; margin: 10px 0 0; letter-spacing: -.6px; }
.panel .eyebrow { font-size: 8px; letter-spacing: 2px; }
.settings-content { margin-top: 28px; }
fieldset { padding: 18px 0 0; margin: 0 0 25px; border: 0; border-top: 1px solid var(--line); }
legend { padding: 0 12px 0 0; font-size: 11px; color: var(--gold); }
.slider-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin: 0 0 20px; font-size: 12px; color: #b9b2c0; }
output { font-size: 11px; font-variant-numeric: tabular-nums; color: #8e879a; }
input[type="range"] { width: 100%; grid-column: 1/-1; height: 4px; accent-color: var(--gold); cursor: pointer; margin: 3px 0; }
.switch-row, .select-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; position: relative; color: #b9b2c0; font-size: 12px; min-height: 32px; }
.switch-row + .switch-row { margin-top: 16px; }
.switch-row { cursor: pointer; }
.switch-row small { display: block; color: #837d8c; font-size: 10px; line-height: 1.6; margin-top: 5px; }
.switch-row input { position: absolute; right: 0; width: 34px; height: 20px; opacity: 0; cursor: pointer; }
.switch-track { display: block; width: 32px; height: 18px; flex-shrink: 0; background: #37323f; border-radius: 20px; transition: background .2s; pointer-events: none; }
.switch-track::after { content: ''; display: block; width: 12px; height: 12px; margin: 3px; border-radius: 50%; background: #a49aaf; transition: transform .2s; }
.switch-row input:checked + .switch-track { background: #b9a68a; }
.switch-row input:checked + .switch-track::after { transform: translateX(14px); background: #24202c; }
.switch-row input:focus-visible + .switch-track { outline: 2px solid var(--gold); outline-offset: 4px; }
.select-row { margin-bottom: 20px; }
select { max-width: 55%; background: #211e2c; border: 1px solid #ffffff15; border-radius: 4px; padding: 7px 9px; font-size: 11px; color: #d0c5d6; }
.panel-footer { border-top: 1px solid var(--line); padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.panel-footer span { font-size: 9px; color: #837b8c; }
.panel-footer button { font-size: 10px; }
.muted-text { color: #8e859b; }
.small-panel { text-align: center; width: min(360px, calc(100% - 32px)); padding: 40px; }
.small-panel h2 { font-size: 29px; margin-top: 17px; }
.small-panel p { font-size: 12px; color: #9a91a4; margin: 14px 0 27px; }
.pause-actions { display: flex; flex-direction: column; gap: 6px; }
.small-panel .menu-note { font-size: 9px; margin-top: 20px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 10; padding: 12px 20px; background: #242032; border: 1px solid #b9a68a33; border-radius: 6px; font-size: 12px; color: #ddcfbe; max-width: calc(100% - 32px); text-align: center; pointer-events: none; }
#uiChat {
  --gap: .25rem;
  --input-width: min(25rem, calc(100vw - 3rem));
  --ui-height: 2.75rem;
  --border: .1rem solid rgba(255, 255, 255, .2);
  --border-radius: .25rem;
  --padding: .75rem;
  --primary-text: #fff;
  --message-bg: rgba(0, 0, 0, .3);
  --bot-color: #00d9ff;
  --user-color: rgb(233, 233, 159);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--gap);
  width: var(--input-width);
  bottom: 1.5rem;
  right: 1.5rem;
  position: absolute;
  z-index: 8;
  font-family: 'Inter', sans-serif;
  font-optical-sizing: auto;
  font-weight: 600;
  animation: botcolor 1.5s linear infinite alternate;
}
#chat-messages { grid-column: 1 / -1; display: flex; gap: var(--gap); flex-direction: column; width: 100%; }
#chat-messages::-webkit-scrollbar { width: 0; background: transparent; }
.chat-message { display: flex; flex-direction: column; gap: var(--gap); align-items: flex-start; border: var(--border); border-radius: var(--border-radius); padding: var(--padding); color: var(--primary-text); font-size: 1rem; width: 100%; max-width: 100%; box-sizing: border-box; position: relative; background-color: var(--message-bg); }
.message-header { display: flex; align-items: center; gap: var(--padding); flex-wrap: wrap; }
.message-name { font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-name.bot { color: var(--bot-color); }
.message-name.user { color: var(--user-color); }
.message-text { word-wrap: break-word; word-break: break-word; white-space: pre-wrap; line-height: 1.4; max-width: 100%; overflow-wrap: break-word; hyphens: auto; }
#groupMessage { display: flex; gap: var(--gap); min-width: 0; }
#uiChat .ui-input { height: var(--ui-height); width: 100%; min-width: 0; padding: var(--padding); background: rgba(0, 0, 0, .2); color: var(--primary-text); border: var(--border); border-radius: var(--border-radius); font: 600 1rem 'Inter', sans-serif; outline: none; }
#uiChat .ui-input::placeholder { color: rgba(255, 255, 255, .4); opacity: 1; }
#uiChat .ui-input:focus { border-color: var(--bot-color); }
#uiChat .ui-button { min-width: var(--ui-height); height: var(--ui-height); padding: 0 var(--padding); display: flex; align-items: center; justify-content: center; gap: .35rem; border: var(--border); border-radius: var(--border-radius); background: rgba(0, 0, 0, .2); color: var(--primary-text); font: 600 .875rem 'Inter', sans-serif; }
#uiChat .ui-button:hover { border-color: var(--bot-color); color: var(--bot-color); }
#uiChat .ui-button:active { transform: scale(.95); }
.material-symbols-sharp { font-family: 'Material Symbols Sharp' !important; font-weight: normal !important; font-style: normal !important; font-size: 1.2rem; line-height: 1 !important; letter-spacing: normal !important; text-transform: none !important; white-space: nowrap !important; direction: ltr !important; font-variation-settings: 'FILL' 0, 'wght' 700, 'GRAD' 0, 'opsz' 20; }
#uiChat.collapsed #chat-messages, #uiChat.collapsed #groupMessage { display: none; }
#uiChat.collapsed { width: auto; grid-template-columns: auto; }
#uiChat.collapsed #btnChat { grid-column: 1; }
.dialogue { position: absolute; bottom: clamp(16px, 2.8%, 28px); left: 50%; transform: translateX(-50%); width: min(800px, calc(100% - 64px)); padding: 18px 22px; display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: start; column-gap: 20px; background: linear-gradient(120deg, #25263af5, #161826fa 75%); border: 2px solid #77758e; border-radius: 2px; box-shadow: 0 6px 0 #080b1699, 0 14px 32px #08081166, inset 0 2px #b9b3d21a; font-family: var(--dialogue-font); }
.dialogue::before { content: ''; position: absolute; inset: 5px; border: 1px solid #ada1c22b; pointer-events: none; }
.dialogue::after { content: ''; position: absolute; top: -2px; left: 28px; width: 40px; height: 2px; background: #dcc49e; box-shadow: 6px 0 #dcc49e44; pointer-events: none; }
.dialogue.without-portrait { grid-template-columns: minmax(0, 1fr); }
.dialogue-portrait { width: 88px; height: 96px; overflow: hidden; background: radial-gradient(ellipse at 50% 80%, #49425e, #2c2c44 75%); border: 2px solid #89819c; outline: 3px solid #0f10213b; box-shadow: inset 0 0 0 3px #c3b6d215, 0 4px #0e102166; }
.dialogue-portrait svg { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.dialogue-name { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 500; letter-spacing: .5px; line-height: 1; color: #e6cba3; text-shadow: 2px 2px #0b0c1b; }
.dialogue-name::before { content: ''; width: 5px; height: 5px; background: #dfc9a7; box-shadow: 3px 3px #a78a6a33; opacity: .5; }
.dialogue[data-typing="true"] .dialogue-name::before { opacity: 1; }
#dialogue-text { min-height: 2.9em; font-size: 24px; line-height: 1.45; margin: 8px 0 0; color: #f2e8dd; text-shadow: 2px 2px #0b0c1b80; white-space: pre-wrap; overflow-wrap: anywhere; }
.dialogue[data-typing="true"] #dialogue-text::after { content: ''; display: inline-block; width: 7px; height: 3px; margin-left: 5px; vertical-align: .08em; background: #d6c2a180; }
.dialogue-next { position: absolute; top: 7px; right: 7px; width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; background: none; color: #bfb0b8; }
.dialogue-next:hover { color: #f2dcc1; }
.dialogue-arrow { font-size: 24px; line-height: 1; color: #dfc9a7; }
.dialogue[data-typing="true"] .dialogue-next { color: #8e8391; }
.dialogue-choices { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 160px)); justify-content: center; gap: 10px; margin-top: 10px; padding-top: 12px; border-top: 1px solid #b6a7c12b; }
.dialogue-choice { position: relative; min-height: 52px; padding: 10px 16px 10px 30px; background: #303047; border: 1px solid #9c8ba966; box-shadow: 0 3px #0b0e1a; border-radius: 1px; font-size: 20px; line-height: 1.3; color: #e6d9cd; text-align: left; overflow-wrap: anywhere; }
.dialogue-choice::before { content: ''; position: absolute; left: 15px; top: calc(50% - 3px); width: 5px; height: 5px; border: 1px solid #c5b4c7; }
.dialogue-choice:hover, .dialogue-choice:focus-visible { background: #484057; border-color: #dac09e; color: #fff0d9; }
.dialogue-choice:focus-visible { outline: 2px solid #dac09e; outline-offset: 3px; }
.dialogue-choice:hover::before, .dialogue-choice:focus-visible::before { background: #e6cba3; border-color: #e6cba3; }
.dialogue-choice:active { transform: translateY(2px); box-shadow: 0 1px #0b0e1a; }
.dialogue-choice[aria-pressed="true"] { background: #494052; border-color: #e2c69e; color: #fff0d9; box-shadow: inset 0 0 0 1px #dfc9a733, 0 3px #0b0e1a; }
.dialogue-choice[aria-pressed="true"]::before { background: #e6cba3; border-color: #e6cba3; }
.dialogue-next:disabled { visibility: hidden; }
body[data-reduced-motion="true"] *, body[data-reduced-motion="true"] *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::after { transition: none !important; } }
@media (max-width: 800px) {
  .menu-content { margin-left: 6%; } h1 { font-size: 50px; margin: 0 0 2px; }
  .menu-actions { margin-top: 22px; } .menu-note { margin-top: 12px; }
  .eyebrow { font-size: 8px; letter-spacing: 1.8px; } .menu-subtitle { font-size: 11px; }
  .primary-button { min-width: 175px; min-height: 42px; } .menu-actions .text-button { min-width: 175px; }
  .dialogue { width: calc(100% - 32px); column-gap: 16px; padding: 16px 18px; grid-template-columns: 72px minmax(0, 1fr); }
  .dialogue-portrait { width: 72px; height: 80px; } #dialogue-text { font-size: 22px; }
}
@media (max-width: 900px) and (orientation: portrait) {
  body[data-mode="playing"] .stage { overflow: visible; margin-top: 16px; margin-bottom: 16px; }
  .dialogue { top: calc(100% + 24px); bottom: auto; }
  body[data-mode="playing"][data-dialogue="true"] .stage { margin-bottom: 300px; }
}
@media (max-width: 600px) and (orientation: portrait) {
  .stage { margin: 16px 0 300px; overflow: visible; }
  body[data-mode="playing"] .stage { margin-bottom: 16px; }
  .main-menu { top: auto; bottom: 0; height: auto; transform: translateY(100%); background: none; text-align: center; justify-content: center; padding-top: 28px; }
  .menu-content { margin: 0; padding: 0; } .menu-actions { align-items: center; gap: 4px; margin-top: 23px; }
  .menu-actions .text-button { text-align: center; padding-left: 0; } h1 { font-size: 46px; margin: 0 0 2px; }
  .menu-note { margin-top: 8px; } .menu-subtitle { font-size: 12px; }
  .scene-corner { font-size: 16px; bottom: 7px; right: 10px; }
  .dialogue { width: 100%; padding: 16px; column-gap: 14px; grid-template-columns: 58px minmax(0, 1fr); }
  .dialogue-portrait { width: 58px; height: 66px; }
  .dialogue-name { font-size: 18px; }
  #dialogue-text { min-height: 2.9em; font-size: 22px; margin-top: 8px; }
  .dialogue-next { width: 44px; height: 44px; top: 3px; right: 3px; }
  .dialogue-choices { grid-template-columns: minmax(0, 180px); gap: 10px; margin-top: 10px; padding-top: 12px; }
  .dialogue-choice { min-height: 48px; font-size: 20px; padding: 10px 16px 10px 32px; }
  body[data-mode="playing"][data-dialogue="true"] .stage { margin-bottom: 330px; }
}
@media (max-height: 600px) and (orientation: landscape) {
  h1 { font-size: 42px; margin: 0 0 2px; } .menu-actions { margin-top: 17px; gap: 0; }
  .menu-note { display: none; } .menu-subtitle { font-size: 11px; } .primary-button { min-height: 38px; padding: 9px 15px; }
  .dialogue { bottom: 10px; width: min(720px, calc(100% - 32px)); padding: 12px 16px; grid-template-columns: 58px minmax(0, 1fr); column-gap: 14px; }
  .dialogue-portrait { width: 58px; height: 64px; } .dialogue-name { font-size: 18px; } #dialogue-text { font-size: 20px; min-height: 1.45em; margin-top: 7px; }
  .dialogue-choices { margin-top: 8px; padding-top: 10px; gap: 10px; }
  .dialogue-choice { min-height: 44px; font-size: 17px; padding: 8px 12px 8px 26px; }
  .dialogue-choice::before { left: 12px; }
}
