:root {
    --bg-dark: #070b14;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --blue: #3b82f6;
    --yellow: #f59e0b;
    --blue-glow: rgba(59, 130, 246, 0.5);
    --yellow-glow: rgba(245, 158, 11, 0.5);
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --font-scale: 1.2;
    --map-transition-duration: 1.2s;
    /* Large screen scaling */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    font-family: 'Outfit', 'Noto Sans SC', sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    font-size: calc(1rem * var(--font-scale));
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.1) 0px, transparent 40%),
        radial-gradient(at 100% 100%, rgba(245, 158, 11, 0.08) 0px, transparent 40%),
        radial-gradient(at 50% 50%, rgba(15, 23, 42, 1) 0px, transparent 100%);
}

.app-container {
    width: 100%;
    max-width: 1600px;
    height: 100vh;
    margin: 0 auto;
    padding: 80px 2rem 160px 2rem;
    /* Increased bottom padding to 160px for footer buttons */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
    /* Important for flex child overflow */
}

header {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

.glass-text {
    font-size: 3rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #fff 30%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 6px;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.1));
}

.status-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-size: 1rem;
}

.timer-floating-box {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 5%;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    z-index: 12000;
    /* Increased to stay above draw overlay if needed */
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* Fairness Verification Overlay */
#verification-overlay {
    z-index: 25000;
}

.verification-content {
    max-width: 900px;
    width: 90%;
    padding: 3.5rem;
    text-align: left;
    background: rgba(10, 15, 30, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.verif-header h2 {
    font-size: 2.2rem;
    color: var(--blue);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.verif-header p {
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 2.5rem;
}

.seed-reveal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.seed-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 16px;
}

.seed-card .label {
    display: block;
    font-size: 0.75rem;
    color: var(--blue);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.seed-card code {
    font-size: 1.1rem;
    color: white;
    word-break: break-all;
    font-family: 'Consolas', monospace;
}

.formula-box {
    background: rgba(59, 130, 246, 0.05);
    border-left: 4px solid var(--blue);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 0 12px 12px 0;
}

.formula-label {
    color: rgba(255, 255, 255, 0.7);
    margin-right: 1rem;
}

.verif-logs {
    height: 180px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 1.2rem;
    overflow-y: auto;
    font-family: 'Consolas', monospace;
    font-size: 0.9rem;
    margin-bottom: 2.5rem;
}

.verif-log-line {
    margin-bottom: 0.6rem;
    display: flex;
    justify-content: space-between;
}

.verif-log-line .status-ok {
    color: #10b981;
}

.verif-log-line .status-wait {
    color: #f59e0b;
}

.verif-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.verif-status-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.8rem 1.5rem;
    border-radius: 100px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #10b981;
    font-weight: 600;
}

.pulse-icon {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(0.9);
        opacity: 0.7;
    }
}

.status-task-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.main-task {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.sub-task {
    font-size: 0.8rem;
    color: var(--blue);
    opacity: 0.8;
    margin-top: 4px;
}

.timer-display-group {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

/* 进度条背景 - 简约高级感 */
.timer-floating-box::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: var(--progress-width, 0%);
    background: linear-gradient(90deg, var(--blue), #6366f1);
    z-index: 1;
    transition: width 0.3s ease;
    box-shadow: 0 0 20px var(--blue-glow);
}

.timer-floating-box .timer-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: -4px;
}

.timer-floating-box .timer-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.speed-control {
    width: auto;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.speed-control label {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.speed-control input[type="range"] {
    flex: 1;
    accent-color: var(--blue);
}

.speed-control span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--blue);
    min-width: 2.5rem;
}

/* 简约的变化反馈 */
.timer-tick-anim {
    opacity: 0.7;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--glass-bg);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    border: 1px solid var(--glass-border);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.blue {
    background-color: var(--blue);
    box-shadow: 0 0 10px var(--blue-glow);
}

.dot.yellow {
    background-color: var(--yellow);
    box-shadow: 0 0 10px var(--yellow-glow);
}

.fairness-verification {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 500;
}

.shield-active {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
    animation: fairness-pulse 2s infinite;
}

@keyframes fairness-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.5);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}


/* Grid Layout */
.seat-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 15px;
    padding: 1rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    flex: 1;
    min-height: 0;
    /* 更加灵动的贝塞尔曲线，增强“弹射”感 */
    transition: all var(--map-transition-duration, 1.2s) cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center center;
    perspective: 2000px;
}

/* Grid Zoom/Focus States */
.seat-grid.zoomed {
    /* 增加基础缩放倍率，并加入微小的 3D 倾斜增强空间感 */
    transform: scale(2.8) rotateX(5deg);
    /* Individual offsets will be set via JS inline styles */
}

.seat-grid.normal {
    transform: scale(1) translate(0, 0) rotateX(0deg) !important;
}

/* Dim unrelated seats when focused */
.seat-grid.zoomed .seat {
    opacity: 0.2;
    filter: blur(2px) grayscale(0.5);
}

.seat-grid.zoomed .seat.focus-target {
    opacity: 1;
    filter: none;
    transform: translateZ(50px);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
    z-index: 10;
}


.seat {
    aspect-ratio: 16/10;
    background: var(--glass-bg);
    border: 1.5px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}



.seat.blue-type {
    border-color: rgba(59, 130, 246, 0.3);
}

.seat.yellow-type {
    border-color: rgba(245, 158, 11, 0.3);
}

.seat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    position: absolute;
    top: 5px;
    left: 8px;
}

.seat-name {
    font-size: 1.4rem;
    font-weight: 700;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s ease;
}

.seat.filled {
    border-width: 3px;
    transform: translateZ(20px);
}

.seat.filled.blue-type {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(29, 78, 216, 0.6));
    border-color: var(--blue);
    box-shadow: 0 0 20px var(--blue-glow);
}

.seat.filled.yellow-type {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.4), rgba(217, 119, 6, 0.6));
    border-color: var(--yellow);
    box-shadow: 0 0 20px var(--yellow-glow);
}

.seat.filled .seat-name {
    opacity: 1;
    transform: translateY(0);
}

/* Footer Buttons */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 0 2.5rem 0;
    background: linear-gradient(to top, var(--bg-dark) 40%, transparent);
    z-index: 10000; /* Increased to ensure it's above content and credits */
}

button {
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: inherit;
}

.primary-btn {
    background: linear-gradient(135deg, #6366f1, #3b82f6);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.6);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

.secondary-btn:hover {
    background: var(--glass-bg);
    color: white;
}

.hidden {
    display: none !important;
}

/* Author Credits Styles */
.author-credits {
    position: fixed;
    bottom: 0.8rem;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.2rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.2);
    z-index: 9000; /* Lower than footer */
    pointer-events: none;
}

.author-credits a {
    pointer-events: auto;
    /* Re-enable clicks for links */
}

.author-credits .text-link {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.3s ease;
    border-bottom: 1px solid transparent;
}

.author-credits .text-link:hover {
    color: var(--blue);
    border-bottom: 1px solid var(--blue);
}

.author-credits .divider {
    color: rgba(255, 255, 255, 0.1);
}

.author-credits .license {
    color: rgba(255, 255, 255, 0.4);
}

/* Overlay Styling */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.99) 0%, rgba(7, 11, 20, 1) 100%);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    z-index: 10000;
    /* Base overlay z-index */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#intro-overlay {
    z-index: 20000;
    /* 再次提升优先级，确保绝对覆盖 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.intro-content {
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    /* 确保长内容不超出屏幕 */
    overflow-y: auto;
    position: relative;
    border-radius: 40px;
    padding: 4rem;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.8);
}


#settings-overlay {
    z-index: 11100;
    /* Higher than #draw-overlay */
}

#draw-overlay {
    z-index: 10500;
}


.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.overlay-content {
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    padding: 3rem;
    overflow-y: auto;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}

.group-title {
    font-size: 2.8rem;
    margin-bottom: 2rem;
    font-weight: 700;
    letter-spacing: 2px;
    z-index: 10;
    text-align: center;
}

.pool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    width: 100%;
    max-height: 40vh;
    /* 进一步压缩高度，给下面的追踪器腾位置 */
    padding: 1rem;
    overflow-y: auto;
    justify-content: center;
    align-items: start;
    z-index: 10;
    scroll-behavior: smooth;
}



/* 隐藏滚动条但保留功能 */
.pool-grid::-webkit-scrollbar {
    width: 4px;
}

.pool-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.pool-member {
    background: rgba(255, 255, 255, 0.08);
    /* Increased base opacity */
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Stronger border to define boundaries */
    border-radius: 12px;
    padding: 0.6rem 0.4rem;
    /* Tightened padding */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Center content vertically */
    gap: 0.2rem;
    /* Reduced gap */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    overflow: hidden;
    min-height: 75px;
    /* Fixed height to prevent uneven stacking */
}



/* 水位背景层 */
.pool-member::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--water-level, 0%);
    background: linear-gradient(to top, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.4));
    z-index: -1;
    transition: height 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.pool-member.g2::before {
    background: linear-gradient(to top, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.4));
}

/* 分组色条优化 - 改为顶部小点 */
.pool-member::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.pool-member.g1::after {
    background: var(--blue);
    box-shadow: 0 0 10px var(--blue-glow);
}

.pool-member.g2::after {
    background: var(--yellow);
    box-shadow: 0 0 10px var(--yellow-glow);
}

/* 公平性校验追踪器样式 */
.fairness-tracer {
    width: 100%;
    margin-top: 1rem;
    /* Slightly reduced */
    background: rgba(0, 0, 0, 0.4);
    /* Darker for better contrast */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.8rem;
    font-family: 'Consolas', 'Monaco', monospace;
    z-index: 10;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.tracer-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    /* Smaller */
    color: var(--blue);
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
    padding-bottom: 0.4rem;
    letter-spacing: 1px;
}

.tracer-logs {
    height: 90px;
    /* Reduced from 120px */
    overflow-y: auto;
    /* Allow scrolling if many logs */
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.log-entry {
    font-size: 0.7rem;
    display: flex;
    gap: 1rem;
    animation: log-fade-in 0.3s ease-out forwards;
}

.log-time {
    color: rgba(255, 255, 255, 0.3);
}

.log-name {
    color: var(--text-primary);
    font-weight: 600;
    min-width: 60px;
}

.log-hash {
    color: #10b981;
    opacity: 0.8;
    word-break: break-all;
}

.log-score {
    color: var(--yellow);
    font-weight: 700;
    margin-left: auto;
}

@keyframes log-fade-in {
    from {
        transform: translateX(-10px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}


/* 赋分时的光环动画 - 放在一个独立的层以免被裁剪 */
.scoring-aura {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 12px;
    /* Matched with .pool-member radius */
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    /* Softened from 0.8 */
    animation: scoring-pulse 0.6s infinite ease-out;
    pointer-events: none;
    z-index: 10;
}


@keyframes scoring-pulse {
    0% {
        transform: scale(0.95);
        opacity: 1;
    }

    100% {
        transform: scale(1.1);
        opacity: 0;
    }
}

.pool-member.scoring {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    /* Softened from 0.5 */
    transform: translateY(-3px) scale(1.03);
    z-index: 100;
}


.pool-member.scoring .member-score {
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* 核心动态光环 */
/* Removed .pool-member.scoring::before */

/* @keyframes scoring-halo removed */

.pool-member.selected {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
    border-color: #fff;
    transform: scale(1.15);
    z-index: 50;
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.3);
}

.pool-member.loser {
    opacity: 0.1;
    filter: grayscale(1) blur(1px);
}

.member-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.5px;
    z-index: 2;
}

.member-score {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    /* 从 1.6rem 降低，适配 0.xxxx 的显示 */
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    z-index: 2;
    transition: all 0.3s ease;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    line-height: 1;
}


.pool-member.scoring .member-score {
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.pool-member.scoring {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Sorting animation is handled via JS but these classes can help visibility */
.pool-member.sorting {
    z-index: 100;
}

.winner-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    display: flex;
    gap: 3rem;
    justify-content: center;
    align-items: center;
    width: 90%;
}

.winner-card {
    padding: 2.5rem 4rem;
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    text-align: center;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.8);
    animation: winner-pop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex: 1;
    max-width: 450px;
}


@keyframes winner-pop {
    0% {
        transform: translate(0, 20px) scale(0.8);
        opacity: 0;
    }

    100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
}

.winner-name {
    font-size: 5rem;
    font-weight: 800;
    display: block;
    margin: 1rem 0;
    filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.3));
    white-space: nowrap;
}

/* Flying Animation Class */
.flying-name {
    position: fixed;
    z-index: 2000;
    padding: 0.8rem 1.5rem;
    border-radius: 99px;
    font-size: 1.5rem;
    font-weight: 700;
    transition: all 1s cubic-bezier(0.65, 0, 0.35, 1);
    pointer-events: none;
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    /* 禁止换行 */
}

/* Intro Overlay Styles */
.intro-content {
    max-width: 800px;
    width: 90%;
    padding: 3.5rem;
    text-align: center;
    position: relative;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
    animation: content-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.intro-section h2 {
    color: var(--blue);
    margin-bottom: 2.5rem;
    font-size: 2.2rem;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.intro-body {
    text-align: left;
    line-height: 2.2;
    color: rgba(255, 255, 255, 0.2);
    /* 默认半透明，等待高亮 */
    background: rgba(255, 255, 255, 0.02);
    padding: 2.5rem;
    border-radius: 16px;
    font-size: 1.25rem;
}

.intro-body p {
    margin-bottom: 1.5rem;
    transition: all 0.5s ease;
    padding: 0 1rem;
    border-left: 2px solid transparent;
}

.intro-body p.highlight {
    color: #fff;
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--blue);
    transform: translateX(10px);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    opacity: 1 !important;
}

.intro-section.hidden {
    display: none;
}

.intro-footer {
    margin-top: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
}

#intro-timer-unit {
    font-weight: 600;
    color: var(--blue);
}

.text-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.text-btn:hover {
    color: #fff;
}

@keyframes content-in {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ready State Styles */
.ready-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 300px;
    animation: ready-pulse 1s infinite alternate;
}

.ready-title {
    font-size: 8rem;
    font-weight: 900;
    margin: 0;
    background: linear-gradient(135deg, #fff, var(--blue));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 12px;
}

.ready-subtitle {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 1rem;
    letter-spacing: 4px;
    font-weight: 300;
}

@keyframes ready-pulse {
    from {
        transform: scale(1);
        filter: brightness(1);
    }

    to {
        transform: scale(1.05);
        filter: brightness(1.2);
    }
}

.ready-active .intro-footer {
    display: none !important;
}

.settings-content {
    max-width: 1100px;
    width: 95%;
    max-height: 85vh;
    padding: 3.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.settings-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-item.full-width {
    grid-column: span 2;
}

.settings-item label {
    font-size: 0.9rem;
    color: var(--blue);
    font-weight: 600;
}

.settings-item textarea {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.2rem;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    min-height: 180px;
    resize: vertical;
    transition: all 0.3s ease;
}

.settings-item textarea:focus {
    outline: none;
    border-color: var(--blue);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}


.json-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.json-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.json-group span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.settings-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-content h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.visual-editor-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1.5rem;
}

.editor-seat {
    aspect-ratio: 16/10;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.02);
    position: relative;
    user-select: none;
}

.editor-seat:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.editor-seat.g1 {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(59, 130, 246, 0.6));
    border: 1.5px solid var(--blue);
    color: white;
}

.editor-seat.g2 {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.4), rgba(245, 158, 11, 0.6));
    border: 1.5px solid var(--yellow);
    color: white;
}

.validation-panel {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.validation-content {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.validation-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.85rem;
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}


.validation-item i {
    font-size: 1.1rem;
}

.validation-item.error {
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.05);
}

.validation-item.warn {
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
    background: rgba(245, 158, 11, 0.05);
}

.validation-item.success {
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.05);
}

.editor-seat input {
    width: 60%;
    height: 60%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: white;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: text;
    pointer-events: auto;
    z-index: 5;
}

.editor-seat input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.3);
    border-color: #fff;
}

.settings-item textarea[readonly] {
    opacity: 0.6;
    background: rgba(0, 0, 0, 0.3);
    cursor: not-allowed;
}

/* --- Multi-terminal Adaptation --- */

/* Tablet Optimization (768px - 1024px) */
@media screen and (max-width: 1024px) {
    .app-container {
        padding: 70px 1.5rem 120px 1.5rem;
    }

    .glass-text {
        font-size: 2.2rem;
        letter-spacing: 4px;
    }

    .seat-grid {
        gap: 10px;
        padding: 0.5rem;
    }

    .seat-name {
        font-size: 1.1rem;
    }

    .timer-floating-box {
        padding: 0 3%;
    }

    .speed-control {
        padding-left: 1rem;
    }
}

/* Mobile Optimization (Below 768px) */
@media screen and (max-width: 768px) {
    .app-container {
        padding: 60px 1rem 140px 1rem;
        height: auto;
        min-height: 100vh;
        gap: 1rem;
    }

    .glass-text {
        font-size: 1.4rem;
        letter-spacing: 2px;
    }

    .status-bar {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    .status-item {
        width: 100%;
        max-width: 250px;
        justify-content: center;
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Grid layout adjustment: Improved for mobile */
    .seat-grid {
        grid-template-columns: repeat(10, 1fr);
        grid-template-rows: repeat(6, 1fr);
        gap: 4px;
        width: 100%;
        min-width: 500px; /* Ensure seats remain readable */
        margin: 0 auto;
        transform: none;
        perspective: 1000px;
    }

    /* Container for horizontal scroll if grid is too wide */
    main {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        display: block;
        padding-bottom: 2rem;
        mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    }

    .seat {
        aspect-ratio: 16/10;
        min-width: 50px;
    }

    .seat-label {
        font-size: 0.5rem;
        top: 2px;
        left: 3px;
    }

    .seat-name {
        font-size: 0.7rem;
    }

    /* Floating box mobile adjustment */
    .timer-floating-box {
        height: 60px;
        padding: 0 1rem;
    }

    .main-task {
        font-size: 0.9rem;
    }

    .sub-task {
        font-size: 0.65rem;
    }

    .timer-display-group {
        left: unset;
        right: 1rem;
        transform: none;
        text-align: right;
    }

    .timer-floating-box .timer-value {
        font-size: 1.5rem;
    }

    .timer-floating-box .timer-label {
        font-size: 0.5rem;
    }

    .speed-control {
        display: none; /* Hide speed control on small mobiles to save space */
    }

    /* Footer buttons stacking */
    footer {
        flex-direction: column;
        gap: 0.8rem;
        padding: 1rem 1rem 2rem 1rem;
        background: linear-gradient(to top, var(--bg-dark) 80%, transparent);
    }

    button {
        width: 100%;
        padding: 0.8rem;
        font-size: 1rem;
    }

    /* Overlays */
    .intro-content, .settings-content, .overlay-content {
        padding: 1.5rem;
        width: 95%;
        border-radius: 20px;
    }

    .intro-content h2, .settings-content h2, .group-title {
        font-size: 1.5rem;
    }

    .pool-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        max-height: 50vh;
    }

    .pool-member {
        min-height: 60px;
        padding: 0.4rem;
    }

    .member-name {
        font-size: 0.8rem;
    }

    .visual-editor-grid {
        grid-template-columns: repeat(5, 1fr);
        padding: 1rem;
    }

    /* Zoom behavior on mobile */
    .seat-grid.zoomed {
        transform: scale(1.5) !important; /* Less zoom on mobile */
    }

    /* Author credits mobile adjustment */
    .author-credits {
        position: fixed;
        top: 75px; /* Stay below the floating timer box */
        bottom: auto;
        padding-bottom: 0;
        margin-top: 0;
        flex-direction: row;
        gap: 0.6rem;
        font-size: 0.6rem;
        background: transparent;
        pointer-events: none;
        z-index: 12000;
    }
}

/* Small heights adjustment */
@media screen and (max-height: 600px) {
    .timer-floating-box {
        position: relative;
        height: auto;
        padding: 0.5rem;
    }

    .app-container {
        padding-top: 1rem;
    }
}