/* === Basic Reset === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* === Ensure Page Scrolling on Overflow === */
html {
    height: 100%; /* 确保 html 元素本身能撑开高度 */
}

/* === Body Styling (Gradient Background + Noise) === */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    /* Deep Indigo Gradient Background */
    background: radial-gradient(ellipse at 50% 30%, #182033 0%, #0f111a 75%);
    color: #D1D5DB;
    /* Use Grey text instead of pure white */
    min-height: 100vh; /* 确保 body 至少有视口那么高 */
    display: flex;      /* 使用 Flexbox 布局 */
    flex-direction: column; /* 让子元素垂直排列 */
    align-items: center;
    justify-content: flex-start;
    gap: 1.5rem;
    /* Adjust gap if needed */
    padding: 2rem; /* Existing padding */
    padding-bottom: 4rem; /* 例如增加 4rem 的底部内边距 */
    overflow-y: auto;   /* !!! 关键：当垂直内容溢出时，自动显示滚动条 */
    position: relative;
    /* Needed for pseudo-element positioning */
}

/* 确保我们之前添加的主题列表容器在内容过多时也能滚动 */
/* (这些 max-height 和 overflow-y 应该已通过 Tailwind 类或之前的 CSS 添加，这里是确认) */
#topic-list-container-step1, #subtopic-list-container-step1 {
    overflow-y: auto; /* 允许这两个 div 内部滚动 */
    /* max-height: 200px; */ /* 已在 HTML 中通过 Tailwind 设置了 max-h-xx 类 */
    /* max-height: 150px; */ /* 已在 HTML 中通过 Tailwind 设置了 max-h-xx 类 */
}

/* 确保主内容容器不会阻止 body 滚动 */
/* Tailwind 的 container class 通常没问题，但如果还有问题可以尝试 */
/*
.container {
    flex-grow: 1; // 允许容器在 flex 布局中增长
}
*/
/* === End Scrolling Fix === */


/* Noise Texture Overlay */
body::before {
    content: "";
    position: fixed;
    /* Use fixed to cover viewport */
    inset: 0;
    /* --- IMPORTANT: Ensure noise.png exists at /static/img/noise.png --- */
    background: url(/static/img/noise.png);
    opacity: .04;
    /* Low opacity noise */
    pointer-events: none;
    /* Allow clicks through */
    z-index: -1;
    /* Place behind content */
}

/* === Header === */
header {
    width: 100%;
    max-width: 1200px;
    text-align: center;
    margin-bottom: 1rem;
    z-index: 1;
    /* Ensure header is above background */
}

header h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    letter-spacing: 0.05em;
    font-weight: 600;
    background: linear-gradient(90deg, #3abcf8, #8b5cf6);
    -webkit-background-clip: text;
    color: transparent;
}

header p {
    font-size: 0.95rem;
    color: #9CA3AF;
    /* Slightly lighter grey for description */
    margin-top: 0.5rem;
}

/* === Config Area (Glassmorphism) === */
.config-area {
    /* Glassmorphism Styles */
    background: rgba(30, 33, 48, 0.5);
    /* Semi-transparent background based on #1e2130 */
    backdrop-filter: blur(12px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Subtle white border */
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    /* Adjusted shadow */
    border-radius: 16px;
    /* Increased border radius */

    padding: 1.5rem;
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 1;
    /* Ensure above background */
}

.config-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.config-item label {
    font-size: 0.9rem;
    color: #cbd5e1;
    font-weight: 500;
}

/* === Input Styling (with Focus Glow) === */
.config-input {
    background: rgba(38, 42, 60, 0.7);
    /* Slightly more transparent input background */
    border: 1px solid rgba(71, 85, 105, 0.8);
    /* Adjusted border */
    border-radius: 6px;
    /* Slightly larger radius */
    padding: 0.6rem 0.85rem;
    /* Adjusted padding */
    color: #f1f5f9;
    font-size: 0.9rem;
    width: 100%;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    /* Add transition for focus */
}

.config-input:focus {
    outline: none;
    border-color: rgba(58, 139, 255, 0.7);
    /* Focus border color using brand blue */
    /* Subtle Focus Glow using brand blue */
    box-shadow: 0 0 0 3px rgba(58, 139, 255, 0.3);
}

textarea.config-input {
    resize: vertical;
    min-height: 45px;
}

/* === Preset Buttons Container === */
#preset-buttons-container {
    z-index: 1;
    /* Ensure above background */
}

/* === Roundtable Stage === */
.stage {
    position: relative;
    width: min(80vw, 450px);
    height: min(80vw, 450px);
    margin-top: 1rem;
    border-radius: 50%;
    border: 3px solid rgba(58, 139, 255, 0.5);
    /* Use brand blue, slightly transparent */
    z-index: 1;
    /* Ensure above background */
}

/* Inner table text - keep simple */
.table {
    position: absolute;
    inset: 10%;
    margin: auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table::after {
    content: "选择座位";
    color: #64748b;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    opacity: 0.6;
    /* Make inner text less prominent */
}

/* === Seats Styling & Interaction === */
.seat {
    position: absolute;
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: rgba(38, 42, 60, 0.7);
    /* Match input bg */
    border: 1px solid #475569;
    /* Adjusted border */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.3s ease;
    /* Smooth transition for hover effects */
    user-select: none;
    text-align: center;
    padding: 2px;
    line-height: 1.2;
    opacity: 0.7;
    /* Default low brightness */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    /* Add subtle shadow */
}

.seat:hover {
    opacity: 1;
    /* Full brightness on hover */
    border-color: #8b5cf6;
    /* Keep purple highlight border */
    /* Outer Glow Effect */
    box-shadow: 0 0 12px 2px rgba(139, 92, 246, 0.5);
    transform: scale(1.05) translate(-50%, -50%);
    /* Apply original translate *after* scale */
}

/* Specific Seat Adjustments (Keep position logic as user adjusted) */
:root {
    --r: calc(min(80vw, 450px) / 2 - 55px);
}

/* Keep user adjusted radius */

.seat[data-seat-id="0"] {
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% - var(--r)));
}

.seat[data-seat-id="1"] {
    top: calc(50% - var(--r) * 0.5);
    left: calc(50% - var(--r) * 0.85);
    transform: translate(-50%, -50%);
}

.seat[data-seat-id="2"] {
    top: calc(50% + var(--r) * 0.4);
    left: calc(50% - var(--r) * 0.90);
    transform: translate(-50%, -50%);
}

.seat[data-seat-id="3"] {
    top: calc(50% + var(--r) * 1);
    left: 50%;
    transform: translate(-50%, -50%);
}

.seat[data-seat-id="4"] {
    top: calc(50% + var(--r) * 0.4);
    left: calc(50% + var(--r) * 0.90);
    transform: translate(-50%, -50%);
}

.seat[data-seat-id="5"] {
    top: calc(50% - var(--r) * 0.5);
    left: calc(50% + var(--r) * 0.85);
    transform: translate(-50%, -50%);
}

/* Apply hover transform correction to *all* positioned seats */
.seat[data-seat-id="0"]:hover {
    transform: scale(1.05) translate(-50%, calc(-50% - var(--r)));
    animation: none;
    /* Disable pulse on hover? */
}

.seat[data-seat-id="1"]:hover {
    transform: scale(1.05) translate(-50%, -50%);
}

.seat[data-seat-id="2"]:hover {
    transform: scale(1.05) translate(-50%, -50%);
}

.seat[data-seat-id="3"]:hover {
    transform: scale(1.05) translate(-50%, -50%);
}

.seat[data-seat-id="4"]:hover {
    transform: scale(1.05) translate(-50%, -50%);
}

.seat[data-seat-id="5"]:hover {
    transform: scale(1.05) translate(-50%, -50%);
}


.seat.host {
    /* background: #3abcf8; */
    /* Using brand color */
    background: #3A8BFF;
    /* New Brand Color */
    color: #FFFFFF;
    /* White text for contrast */
    font-weight: 600;
    border-color: rgba(58, 139, 255, 0.8);
    cursor: default;
    opacity: 1;
    /* Host always full brightness */
    animation: pulse 4s infinite ease-in-out;
    /* Pulse animation */
}

.seat.host:hover {
    /* Keep hover consistent or slightly different? */
    box-shadow: 0 0 12px 2px rgba(58, 139, 255, 0.6);
    /* transform: scale(1.05) translate(-50%, calc(-50% - var(--r))); */
    /* Hover scale included in base hover */
}

/* Pulse Animation */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1) translate(-50%, calc(-50% - var(--r)));
    }

    50% {
        transform: scale(1.05) translate(-50%, calc(-50% - var(--r)));
    }
}

.seat.assigned {
    border-color: #10b981;
    /* Keep green border for assigned */
    background: rgba(31, 41, 55, 0.8);
    /* Darker semi-transparent bg */
    opacity: 1;
    /* Assigned seats full brightness */
}

.seat .seat-assignment {
    font-size: 0.6rem;
    color: #9CA3AF;
    margin-top: 2px;
    display: block;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Selection Modal (Apply Glassmorphism) === */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    /* Slightly less dark backdrop */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    /* Glassmorphism for Modal */
    background: rgba(30, 33, 48, 0.6);
    /* Semi-transparent background */
    backdrop-filter: blur(10px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    border-radius: 16px;
    /* Match config area */

    padding: 2rem;
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-content h2 {
    font-size: 1.2rem;
    color: #cbd5e1;
    text-align: center;
}

.modal-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.modal-section label {
    font-size: 0.9rem;
    color: #9CA3AF;
}

/* Lighter grey */
.modal-section select {
    /* Match input style */
    background: rgba(38, 42, 60, 0.7);
    border: 1px solid rgba(71, 85, 105, 0.8);
    border-radius: 6px;
    padding: 0.6rem 0.85rem;
    color: #f1f5f9;
    font-size: 0.9rem;
    width: 100%;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.modal-section select:focus {
    outline: none;
    border-color: rgba(58, 139, 255, 0.7);
    box-shadow: 0 0 0 3px rgba(58, 139, 255, 0.3);
}

.modal-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* === Footer & Buttons Styling === */
footer {
    margin-top: 2rem;
    /* Increased margin */
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    z-index: 1;
}

.btn {
    padding: 0.7rem 1.5rem;
    /* Slightly larger padding */
    border: none;
    border-radius: 10px;
    /* More rounded */
    background: #3A8BFF;
    /* Brand blue */
    color: #FFFFFF;
    /* White text */
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all .25s ease;
    /* Smoother transition */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    /* Subtle shadow */
}

.btn:hover {
    background: #2576f5;
    /* Slightly darker blue on hover */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
    /* Slight lift effect */
}

.btn:active {
    transform: translateY(0px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
    background: #334155;
    color: #64748b;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn.btn-secondary {
    background: rgba(71, 85, 105, 0.5);
    /* Semi-transparent grey */
    color: #cbd5e1;
    border: 1px solid rgba(100, 116, 139, 0.5);
    box-shadow: none;
}

.btn.btn-secondary:hover {
    background: rgba(82, 95, 118, 0.7);
    /* Darker hover for secondary */
    border-color: rgba(100, 116, 139, 0.8);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn.btn-secondary:active {
    transform: translateY(0px);
    box-shadow: none;
}

/* Specific style for preset buttons if needed */
.preset-btn {
    /* Inherits .btn and .btn-secondary */
    padding: 0.4rem 0.9rem;
    /* Make preset buttons smaller */
    font-size: 0.8rem;
}

/* --- Step Indicator Styles --- */
#step-indicator {
    width: 100%;
    max-width: 500px; /* Adjust as needed */
    margin-left: auto;
    margin-right: auto;
}

.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #64748b; /* Default color (slate-500) */
    transition: all 0.3s ease;
}

.step-indicator .step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #64748b; /* Default border */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 0.25rem;
    background-color: rgba(51, 65, 85, 0.3); /* Default background (slate-700/30) */
    transition: all 0.3s ease;
}

.step-indicator .step-label {
    font-size: 0.8rem;
    font-weight: 500;
}

.step-indicator.active .step-number {
    border-color: #3A8BFF; /* Active border (brand blue) */
    background-color: rgba(58, 139, 255, 0.2); /* Active background */
    color: #e2e8f0; /* Active text (slate-200) */
    box-shadow: 0 0 8px rgba(58, 139, 255, 0.5);
}

.step-indicator.active .step-label {
    color: #e2e8f0; /* Active text */
}

.step-indicator.completed .step-number { /* Optional: Style for completed steps */
     border-color: #10b981; /* Green border */
     background-color: rgba(16, 185, 129, 0.1);
     color: #a7f3d0; /* Lighter green text */
}
.step-indicator.completed .step-label {
     color: #9ca3af; /* Slightly dimmer than active */
}


.step-line {
    flex-grow: 1;
    height: 2px;
    background-color: #475569; /* Line color (slate-600) */
    margin: 0 0.5rem;
    transform: translateY(-16px); /* Align with middle of numbers */
    min-width: 20px;
}

/* --- Step Container (Card) Styles --- */
.step-container {
    /* Reuse or adapt glassmorphism from .config-area */
    background: rgba(30, 33, 48, 0.5);
    backdrop-filter: blur(12px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border-radius: 16px;
    padding: 1.5rem 2rem; /* Increased padding */
    margin-top: 1.5rem;
    display: none; /* Hide inactive steps by default */
}

.step-container.active-step {
    display: block; /* Show the active step */
    animation: fadeIn 0.5s ease-out; /* Optional fade-in */
}

.step-title {
    font-size: 1.25rem; /* Larger step title */
    font-weight: 600;
    color: #cbd5e1; /* slate-300 */
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Topic/Subtopic Chip Styles --- */
.topic-chip, .subtopic-chip {
    display: inline-block;
    padding: 0.4rem 0.9rem; /* Smaller padding */
    border: 1px solid #475569; /* Default border (slate-600) */
    border-radius: 20px; /* Pill shape */
    background-color: rgba(51, 65, 85, 0.4); /* slate-700 with alpha */
    color: #cbd5e1; /* slate-300 */
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 2px; /* Small gap */
    user-select: none;
}

.topic-chip:hover, .subtopic-chip:hover {
    background-color: rgba(71, 85, 105, 0.6); /* slate-600 with alpha */
    border-color: #64748b; /* slate-500 */
}

.topic-chip.selected, .subtopic-chip.selected {
    background-color: #3A8BFF; /* Brand blue */
    border-color: #2576f5;
    color: #FFFFFF;
    font-weight: 500;
    box-shadow: 0 0 8px rgba(58, 139, 255, 0.4);
}

/* Container for chips */
#topic-chips-container, #subtopic-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem; /* Adjust gap between chips */
}

/* Hide subtopic section initially */
#subtopic-section.hidden {
    display: none;
}

/* Topic Background Display */
#topic-background-display, #topic-background-display-step2 {
    border-color: rgba(71, 85, 105, 0.5); /* slate-600/50 */
}
#topic-background-display.hidden {
     display: none;
}
#topic-background-content, #topic-background-content-step2 {
     margin-top: 0.25rem;
}

/* --- Side Drawer Styles --- */
.side-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0; /* Or height: 100vh; */
    width: 90%; /* Responsive width */
    max-width: 400px; /* Max width */
    background-color: #1e293b; /* slate-800 (or slightly lighter/darker) */
    /* Apply glassmorphism if desired */
    /* background: rgba(30, 41, 59, 0.8); */
    /* backdrop-filter: blur(10px); */
    border-left: 1px solid #475569; /* slate-600 */
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 110; /* Higher than overlay */
    overflow-y: auto; /* Allow scrolling within drawer */
}

.side-drawer.open {
    transform: translateX(0);
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 105; /* Below drawer */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s;
}

.drawer-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* --- Footer/Navigation Buttons --- */
footer {
    /* Keep existing footer styles or adjust as needed */
    margin-top: 2rem; /* Ensure space above buttons */
}

/* Ensure start button visibility is controlled by JS adding/removing 'hidden' */
#btn-start.hidden {
    display: none;
}

/* --- Utility --- */
.hidden {
    display: none !important; /* Use !important carefully if needed */
}

/* --- Icon Button Styles --- */
.btn-icon {
    display: inline-flex; /* Use flex to center content */
    align-items: center;
    justify-content: center;
    width: 28px; /* Fixed width */
    height: 28px; /* Fixed height */
    border-radius: 50%; /* Make it circular */
    border: 1px solid transparent; /* Transparent border initially */
    font-size: 1.2rem; /* Adjust icon size */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0; /* Remove padding */
    line-height: 1; /* Adjust line height for vertical centering */
    user-select: none;
}

.btn-icon.add-btn {
    background-color: rgba(16, 185, 129, 0.2); /* Green background (e.g., green-500/20) */
    color: #34d399; /* Green text (e.g., green-400) */
    border-color: rgba(16, 185, 129, 0.4); /* Green border */
}

.btn-icon.add-btn:hover {
    background-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7; /* Lighter green */
    border-color: rgba(16, 185, 129, 0.6);
    box-shadow: 0 0 5px rgba(16, 185, 129, 0.5);
}

.btn-icon:disabled { /* Optional: Style for disabled state */
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Ensure the flex containers added in HTML work as expected */
.flex.justify-between.items-center {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- Delete Icon inside Chip Styles --- */
.chip-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px; /* Small size */
    height: 16px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1); /* Subtle background */
    color: #9ca3af; /* slate-400 */
    font-size: 0.7rem; /* Small icon/text */
    font-weight: bold;
    line-height: 1;
    margin-left: 6px; /* Space between text and delete icon */
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    padding: 0;
}

.chip-delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.8); /* Red background on hover (red-500) */
    color: #ffffff; /* White icon */
    transform: scale(1.1);
}

/* Adjust chip padding slightly to accommodate the button if needed */
.topic-chip, .subtopic-chip {
    display: inline-flex; /* Use flex to align text and delete button */
    align-items: center;
    padding-right: 0.5rem; /* Adjust right padding */
}