/* style_base.css */
/* 职责：定义全局样式、字体、颜色变量和基础布局。 */

/* 全局禁止用户选中文本 */
* {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 全局禁止图片被拖拽 */
img {
  -webkit-user-drag: none;
}

@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 400;
  src: url('fonts/NotoSansSC-Regular.ttf') format('truetype');
}

@font-face {
  font-family: 'Noto Sans SC';
  font-style: normal;
  font-weight: 700;
  src: url('fonts/NotoSansSC-Bold.ttf') format('truetype');
}

:root {
    --color-bg: #1a202c;
    --color-panel: #2d3748;
    --color-panel-light: #4a5568;
    --color-border: #4a5568;
    --color-purple: #8B5CF6;
    --color-text-dim: #a0aec0;
    --color-buff: #4ade80;
}

html {
    font-size: clamp(10px, 1vw, 16px);
}

/* Web 根字号锁定为设计稿基准，再整体 transform scale */
html.platform-web {
    font-size: 16px;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: #000;
    color: white;
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 98vw; 
    height: 55.125vw;
    max-height: 98vh;
    max-height: 98dvh;
    max-width: 174.22vh;
    max-width: 174.22dvh;
    aspect-ratio: 16 / 9;
    background-color: var(--color-bg);
    border: 0.125rem solid var(--color-border);
    border-radius: 0.75rem;
    overflow: hidden;
    /* 手机浏览器：减少双击缩放与滚动穿透 */
    touch-action: manipulation;
}

/* Web：外层舞台吃缩放后尺寸，内层 1600×900 从左上角 scale（避免布局盒被裁成全黑） */
body.platform-web {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--vvw, 100vw);
    height: var(--vvh, 100dvh);
    min-height: var(--vvh, 100dvh);
    overflow: hidden;
}

body.platform-web #game-stage {
    position: relative;
    width: var(--game-stage-w, 1600px);
    height: var(--game-stage-h, 900px);
    flex-shrink: 0;
    overflow: hidden;
}

body.platform-web #game-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 1600px;
    height: 900px;
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    border: none;
    border-radius: 0;
    transform: scale(var(--game-scale, 1));
    transform-origin: 0 0;
}

/* 非 Web：舞台不额外包一层视觉 */
#game-stage {
    display: contents;
}
body.platform-web #game-stage {
    display: block;
}

body.platform-web:fullscreen,
body.platform-web:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
}

/* Web 竖屏提示（Electron 不显示） */
#orientation-gate {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0e14;
    color: #e2e8f0;
    padding: 1.5rem;
    box-sizing: border-box;
    text-align: center;
}
#orientation-gate.hidden {
    display: none !important;
}
.orientation-gate-card {
    max-width: 20rem;
}
.orientation-gate-card p {
    margin: 0.35rem 0;
    font-size: 1.15rem;
    line-height: 1.45;
}
.orientation-gate-sub {
    opacity: 0.65;
    font-size: 0.95rem !important;
}

.scene {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 2rem;
    box-sizing: border-box;
    position: absolute;
    inset: 0;
}

.scene.active {
    display: flex;
}

/* 【修改】将 Debug 和 Settings 分开定义位置 */
#debug-container { 
    position: absolute; 
    top: 0.5rem; 
    left: 0.5rem;
    z-index: 200;
}

#settings-container { 
    position: absolute; 
    bottom: 2rem; 
    left: 2rem; 
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}

/* 全局全屏：右上角，单字临时入口 */
#fullscreen-toggle-btn.global-fullscreen-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 200;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0.4rem 0.65rem;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
}

.global-icon-button {
    background: transparent;
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: grid;
    place-items: center;
    color: var(--color-text-dim);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

/* 【新增】专门放大设置按钮 */
#settings-btn {
    width: 5rem;  /* 尺寸翻倍 */
    height: 5rem;
    /* 可选：加一点半透明背景让它在深色场景中更明显 */
    background-color: rgba(0, 0, 0, 0.3); 
    border-radius: 50%;
}

#settings-btn:hover:not(:disabled) {
    transform: scale(1.1); /* 悬停放大效果 */
    background-color: rgba(0, 0, 0, 0.5);
}

#settings-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    filter: grayscale(0.55);
    background-color: rgba(0, 0, 0, 0.2);
}

#debug-panel {
    background-color: rgba(45, 55, 72, 0.9);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-border);
    margin-top: 0.5rem;
    width: 250px;
}
#debug-panel.hidden { display: none; }

.debug-btn-rage {
    background-color: #DD6B20;
}

/* --- Global Custom Scrollbar --- */
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent; 
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb {
    background-color: var(--color-purple); 
    border-radius: 4px;
    border: 1px solid var(--color-purple); 
}

*::-webkit-scrollbar-thumb:hover {
    background-color: #A78BFA; 
    border-color: #A78BFA;
}

/* --- Foreground Overlay Style --- */
#foreground-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-image: url('images/ui/foreground.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    pointer-events: none; 
    z-index: 100;
    display: none; 
}

/* Show overlay only when battle scene is active */
#scene-battle.active ~ #foreground-overlay {
    display: block;
}

/* --- 全局 Tooltip 样式 --- */
.global-tooltip {
    position: fixed; 
    background-color: rgba(10, 10, 20, 0.9);
    color: #e8e6e3;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: 1px solid #4a5568;
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 300px;
    pointer-events: none; 
    z-index: 9999; 
    transition: opacity 0.1s ease-in-out;
    opacity: 1;
}

.global-tooltip.hidden {
    opacity: 0;
}