/* ============================================================
   2026.10：配色已换成首页「金缮」的天目釉色（青黑底 + 金），文件名沿用
   NOIR GALLERY · 独立页外壳 NOIR PAGE SHELL
   给 snake / tetris / gobang / fruit-ninja / 作业页 等自带内联样式的
   单文件页面，统一换上深炭黑 · 香槟金的画廊外观。
   用法：在各页 </style> 之后 <link> 本文件，靠层叠顺序覆盖。
   与首页 css/noir.css 同一套设计语言。
   ============================================================ */

@font-face {
    font-family: 'Playfair Display';
    src: url('../assets/fonts/playfair-display-latin.woff2') format('woff2');
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2122, U+2191, U+2193, U+2212;
}

:root {
    --nr-void: #151C19;
    --nr-panel: #1D2622;
    --nr-panel-2: #242E29;

    --nr-gold: #C9A456;
    --nr-gold-lift: #E6C980;
    --nr-gold-deep: #9A7A35;

    --nr-bone: #E3E8E2;
    --nr-bone-2: #A3AEA7;
    --nr-bone-3: #77847C;

    --nr-hairline: rgba(227, 232, 226, 0.11);
    --nr-hairline-strong: rgba(227, 232, 226, 0.22);

    --nr-display: 'Playfair Display', 'Songti SC', 'Source Han Serif SC',
                  'Noto Serif CJK SC', 'STSong', Georgia, serif;
    --nr-sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB',
               'Microsoft YaHei', sans-serif;
    --nr-ease: cubic-bezier(0.22, 1, 0.36, 1);

    /* 覆盖各页自带的通用变量名，令整站统一为暗夜画廊 */
    --bg-primary: #151C19;
    --bg-secondary: #18201C;
    --bg-tertiary: #242E29;
    --bg-card: #1D2622;
    --bg-elevated: #28332D;

    --accent-primary: #C9A456;
    --accent-secondary: #E6C980;
    --accent-warm: #B4553F;
    --accent-warm-hover: #C66A53;
    --accent: #C9A456;
    --primary: #C9A456;

    --text-primary: #E3E8E2;
    --text-secondary: #A3AEA7;
    --text-muted: #77847C;
    --text-tertiary: #77847C;

    --border: rgba(227, 232, 226, 0.11);
    --border-color: rgba(227, 232, 226, 0.11);

    --beat-1: #B4553F;
    --beat-2: #C9A456;
    --beat-3: #8AA596;
    --beat-4: #7E9C8C;

    color-scheme: dark;
}

/* ==================== 底色 ==================== */
body {
    background: var(--nr-void);
    background-image:
        radial-gradient(90% 70% at 70% -10%, rgba(138, 165, 150, 0.16), transparent 62%),
        radial-gradient(70% 50% at 0% 100%, rgba(201, 164, 86, 0.05), transparent 62%);
    background-attachment: fixed;
    color: var(--nr-bone);
    font-family: var(--nr-sans);
    letter-spacing: 0.012em;
}

/* 胶片颗粒 */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: url('../assets/img/grain.png');
    background-repeat: repeat;
    opacity: 0.05;
    mix-blend-mode: overlay;
}

/* 装裱边 */
body::after {
    content: '';
    position: fixed;
    inset: 12px;
    z-index: 40;
    pointer-events: none;
    border: 1px solid var(--nr-hairline);
}

/* ==================== 标题 ==================== */
body > h1,
h1 {
    font-family: var(--nr-display);
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--nr-bone);
    text-shadow: none;
}

body > h1 {
    position: relative;
    z-index: 1;
    margin-bottom: 28px;
    font-size: clamp(1.8rem, 4.6vw, 2.7rem);
    text-align: center;
}

/* 标题下的金色细线 */
body > h1::after {
    content: '';
    display: block;
    width: 48px;
    height: 1px;
    margin: 18px auto 0;
    background: var(--nr-gold);
}

h2, h3, h4 {
    font-family: var(--nr-display);
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--nr-bone);
}

/* ==================== 容器 ==================== */
.game-container,
.container,
.main-container,
.content-wrapper {
    position: relative;
    z-index: 1;
    background: var(--nr-panel);
    border: 1px solid var(--nr-hairline);
    border-radius: 2px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.02) inset,
        0 30px 70px -40px rgba(0, 0, 0, 0.9);
}

/* 容器左上角的金色角线 */
.game-container::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 18px;
    height: 18px;
    border-top: 1px solid var(--nr-gold);
    border-left: 1px solid var(--nr-gold);
    opacity: 0.55;
    pointer-events: none;
}

.game-header {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--nr-hairline);
}

.game-info {
    font-family: var(--nr-display);
    font-size: 1.02rem;
    letter-spacing: 0.06em;
    color: var(--nr-bone);
}

.game-instructions,
.instructions,
.tips {
    font-family: var(--nr-sans);
    font-size: 12px;
    letter-spacing: 0.16em;
    color: var(--nr-bone-3);
}

/* ==================== 按钮：细框 → 金填 ==================== */
.btn,
button.btn,
.game-controls button,
.control-btn,
.btn-primary,
.btn-secondary {
    padding: 10px 22px;
    border: 1px solid var(--nr-hairline-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--nr-bone-2);
    font-family: var(--nr-sans);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    box-shadow: none;
    transition: color 0.45s var(--nr-ease), background-color 0.45s var(--nr-ease),
                border-color 0.45s var(--nr-ease);
}

.btn:hover,
.game-controls button:hover,
.control-btn:hover {
    transform: none;
    box-shadow: none;
    color: var(--nr-gold);
    border-color: rgba(201, 164, 86, 0.34);
}

.btn-restart,
.btn-primary,
.control-btn.primary {
    background: transparent;
    color: var(--nr-gold);
    border-color: rgba(201, 164, 86, 0.34);
}

.btn-restart:hover,
.btn-primary:hover,
.control-btn.primary:hover {
    background: var(--nr-gold);
    border-color: var(--nr-gold);
    color: #151C19;
    box-shadow: none;
    transform: none;
}

.btn-home,
.btn-secondary {
    background: transparent;
    color: var(--nr-bone-2);
}

.btn-home:hover,
.btn-secondary:hover {
    background: transparent;
    border-color: var(--nr-hairline-strong);
    color: var(--nr-bone);
    box-shadow: none;
    transform: none;
}

/* ==================== 画布 ==================== */
canvas {
    border-radius: 2px;
}

#snake-canvas,
#tetris-canvas,
#gobang-canvas,
#game-canvas {
    border: 1px solid var(--nr-hairline-strong);
    border-radius: 2px;
    box-shadow:
        inset 0 0 0 1px rgba(227, 232, 226, 0.04),
        0 18px 40px -26px rgba(0, 0, 0, 0.9);
}

/* ==================== 弹窗 ==================== */
.game-over-modal,
.modal,
.overlay {
    background: rgba(21, 28, 25, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.game-over-content,
.modal-content {
    position: relative;
    background: var(--nr-panel-2);
    border: 1px solid var(--nr-hairline-strong);
    border-radius: 2px;
    box-shadow: 0 50px 100px -50px rgba(0, 0, 0, 1);
}

.game-over-content::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 48px;
    height: 1px;
    background: var(--nr-gold);
    transform: translateX(-50%);
}

.game-over-content h2,
.modal-content h2 {
    font-family: var(--nr-display);
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--nr-bone);
}

/* ==================== 难度 / 选择 ==================== */
.difficulty-btn,
.level-btn,
.mode-btn {
    border: 1px solid var(--nr-hairline);
    border-radius: 999px;
    background: transparent;
    color: var(--nr-bone-2);
    font-family: var(--nr-sans);
    font-size: 11px;
    letter-spacing: 0.2em;
}

.difficulty-btn.active,
.level-btn.active,
.mode-btn.active {
    background: var(--nr-gold);
    border-color: var(--nr-gold);
    color: #151C19;
}

/* ==================== 表单 ==================== */
input[type="text"],
input[type="number"],
input[type="password"],
textarea,
select {
    border: 1px solid var(--nr-hairline);
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--nr-bone);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--nr-gold);
}

/* ==================== 分数 / 数字 ==================== */
.score,
.score-value,
.high-score,
#score,
#level,
#lines {
    font-family: var(--nr-display);
    color: var(--nr-gold);
}

/* ==================== 返回落款印 ==================== */
.noir-seal {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 41;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: transparent;
    border: 1px solid rgba(201, 164, 86, 0.4);
    border-radius: 50%;
    color: var(--nr-gold);
    font-family: var(--nr-display);
    font-size: 17px;
    line-height: 1;
    text-decoration: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background 0.5s var(--nr-ease), color 0.5s var(--nr-ease),
                border-color 0.5s var(--nr-ease);
}

.noir-seal:hover {
    background: var(--nr-gold);
    border-color: var(--nr-gold);
    color: #151C19;
}

/* ============================================================
   各页遗留的紫/粉/青渐变，统一收进金色
   （这些是写死在各页内联 <style> 里的，变量覆盖够不到，只能点名）
   ============================================================ */

/* 渐变裁字标题 → 香槟金 */
.homework-title-bar h1 {
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: var(--nr-gold);
    color: var(--nr-gold);
    font-family: var(--nr-display);
    letter-spacing: 0.04em;
}

/* 发光标题 → 去掉彩色光晕 */
.title-overlay h1,
.start-screen h1 {
    font-family: var(--nr-display);
    color: var(--nr-bone);
    text-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

/* 渐变主按钮 → 金框填金 */
.generate-btn,
.start-btn,
.btn-primary {
    background: transparent;
    border: 1px solid rgba(201, 164, 86, 0.4);
    border-radius: 999px;
    color: var(--nr-gold);
    font-family: var(--nr-sans);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    box-shadow: none;
    transition: background 0.45s var(--nr-ease), color 0.45s var(--nr-ease);
}

.generate-btn:hover,
.start-btn:hover,
.btn-primary:hover {
    background: var(--nr-gold);
    border-color: var(--nr-gold);
    color: #151C19;
    transform: none;
    box-shadow: none;
}

@media (max-width: 560px) {
    body::after { inset: 8px; }
    .noir-seal { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
