:root {
    --tno-accent-rust: #6b8ba7;
    --tno-accent-brass: #90aec7;
    --tno-accent-steel: #7897b1;
    --tno-accent-steel-soft: #b3cadf;
    --tno-accent-warning: #5c758d;
    --tno-text-main: #d2dfeb;
    --tno-text-soft: #8fa4b8;
    --tno-deep: #090f18;
    --tno-surface-strong: rgba(11, 21, 34, 0.92);
    --tno-surface-soft: rgba(19, 33, 49, 0.78);
    --tno-grid-lines: rgba(157, 181, 201, 0.1);
    --tno-glow-rust: rgba(107, 139, 167, 0.18);
    --tno-glow-steel: rgba(141, 170, 193, 0.14);
}

/* --- Generator Page Styles --- */
.generator-container {
    max-width: 1280px;
    margin: 1.2rem auto;
    padding: clamp(0.9rem, 1.18vw + 0.72rem, 1.75rem);
    position: relative;
    isolation: isolate;
    overflow: clip;
    border-radius: 2px;
    border: 2px solid rgba(92, 119, 143, 0.74);
    outline: 1px solid rgba(15, 29, 43, 0.88);
    background:
        linear-gradient(180deg, rgba(14, 22, 33, 0.98) 0%, rgba(9, 15, 23, 0.99) 52%, rgba(7, 12, 19, 1) 100%);
    box-shadow:
        inset 0 1px 0 rgba(188, 210, 226, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.76),
        inset 1px 0 0 rgba(172, 196, 215, 0.08),
        inset -1px 0 0 rgba(0, 0, 0, 0.56),
        inset 0 0 0 1px rgba(5, 10, 16, 0.72),
        inset 0 0 0 3px rgba(2, 8, 14, 0.72),
        0 16px 26px rgba(0, 0, 0, 0.66);
}

.generator-container::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(154, 179, 201, 0.08) 0px,
            rgba(154, 179, 201, 0.08) 1px,
            transparent 1px,
            transparent 4px
        ),
        repeating-linear-gradient(
            to right,
            rgba(112, 137, 159, 0.035) 0px,
            rgba(112, 137, 159, 0.035) 1px,
            transparent 1px,
            transparent 7px
        );
    opacity: 0.5;
    z-index: 0;
    animation: tno-crt-scan-drift 9s linear infinite;
}

.generator-container::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background:
        radial-gradient(circle at 12px 12px, rgba(188, 209, 226, 0.6) 0 1px, rgba(16, 29, 42, 0.9) 2px, transparent 3px),
        radial-gradient(circle at calc(100% - 12px) 12px, rgba(188, 209, 226, 0.6) 0 1px, rgba(16, 29, 42, 0.9) 2px, transparent 3px),
        radial-gradient(circle at 12px calc(100% - 12px), rgba(188, 209, 226, 0.6) 0 1px, rgba(16, 29, 42, 0.9) 2px, transparent 3px),
        radial-gradient(circle at calc(100% - 12px) calc(100% - 12px), rgba(188, 209, 226, 0.6) 0 1px, rgba(16, 29, 42, 0.9) 2px, transparent 3px),
        radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0) 56%, rgba(0, 0, 0, 0.48) 100%),
        linear-gradient(180deg, rgba(188, 208, 224, 0.035) 0%, rgba(188, 208, 224, 0) 20%);
    z-index: 0;
    animation: tno-crt-flicker 9s steps(10, end) infinite;
}

.generator-container > * {
    position: relative;
    z-index: 1;
}

.generator-form-grid .form-group {
    position: relative;
    border: 1px solid rgba(95, 122, 148, 0.65);
    border-radius: 3px;
    padding: 0.86rem 0.86rem 0.9rem;
    background: linear-gradient(180deg, rgba(17, 28, 40, 0.95) 0%, rgba(11, 19, 29, 0.99) 100%);
    box-shadow:
        inset 0 1px 0 rgba(178, 201, 220, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.7),
        inset 1px 0 0 rgba(170, 193, 212, 0.08),
        inset -1px 0 0 rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(6, 11, 18, 0.72),
        0 6px 10px rgba(0, 0, 0, 0.4);
    transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.generator-form-grid .form-group::before {
    content: '';
    position: absolute;
    top: 0;
    left: 8px;
    right: 8px;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(144, 168, 189, 0.42) 50%, rgba(255, 255, 255, 0) 100%);
}

.generator-form-grid .form-group:hover {
    border-color: rgba(111, 141, 169, 0.62);
}

.generator-form-grid .form-group:focus-within {
    border-color: rgba(122, 155, 183, 0.7);
    box-shadow:
        inset 0 0 0 1px rgba(178, 201, 221, 0.06),
        0 0 0 2px rgba(108, 143, 173, 0.22),
        0 10px 16px rgba(0, 0, 0, 0.42);
    transform: translateY(-1px);
}

.generator-form-grid .form-group textarea {
    min-height: 120px;
}

.form-grid,
.generator-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.generator-container .form-group {
    margin-bottom: 0;
}

.generator-container .form-group label {
    display: block;
    margin-bottom: 0.58rem;
    font-size: 0.8rem;
    font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
    color: color-mix(in srgb, var(--tno-text-main) 82%, var(--tno-accent-brass) 18%);
}

.generator-container .form-group input[type="text"],
.generator-container .form-group input[type="url"],
.generator-container .form-group input[type="password"],
.generator-container .form-group textarea,
.generator-container .form-group select {
    width: 100%;
    padding: 0.78rem 0.86rem;
    border-radius: 2px;
    border: 1px solid rgba(88, 115, 140, 0.7);
    background: linear-gradient(180deg, rgba(10, 18, 27, 0.98) 0%, rgba(6, 12, 20, 1) 100%);
    outline: none;
    transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
    box-sizing: border-box;
    font-size: 0.95rem;
    color: var(--tno-text-main);
    font-family: 'Noto Sans SC', sans-serif;
    box-shadow:
        inset 0 1px 0 rgba(157, 182, 204, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.66);
}

.generator-container .form-group input::placeholder,
.generator-container .form-group textarea::placeholder {
    color: color-mix(in srgb, var(--tno-text-soft) 84%, #a8c2d8 16%);
}

.generator-container .form-group textarea {
    min-height: 94px;
    resize: vertical;
}

.generator-form-grid .form-group textarea {
    min-height: 122px;
}

.generator-container .form-group textarea[data-custom-resize] {
    resize: none !important;
}

.generator-container .form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23c6d4e2' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 1 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 14px 11px;
    padding-right: 2.2rem;
}

.generator-container .form-group select:disabled {
    opacity: 0.56;
    cursor: not-allowed;
    color: #a0b2c4;
}

.generator-container .form-group input:focus,
.generator-container .form-group textarea:focus,
.generator-container .form-group select:focus {
    border-color: color-mix(in srgb, var(--tno-accent-brass) 62%, var(--tno-accent-steel-soft) 38%);
    box-shadow:
        0 0 0 2px rgba(117, 151, 179, 0.26),
        inset 0 1px 0 rgba(182, 205, 223, 0.12),
        0 6px 12px rgba(0, 0, 0, 0.48);
    transform: translateY(-1px);
}

/* API Key Input */
.generator-container .api-key-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.generator-container .api-key-wrapper input {
    padding-right: 45px;
    flex-grow: 1;
}

#toggle-api-key-visibility {
    position: absolute;
    right: 1px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    color: #9db5cb;
    font-size: 1.2em;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s ease, color 0.2s ease;
}

#toggle-api-key-visibility:hover {
    opacity: 1;
    color: #dff2ff;
}

#toggle-api-key-visibility:focus {
    outline: none;
}

/* API URL + Fetch Button */
.generator-container .api-url-wrapper {
    display: flex;
    gap: 0;
    align-items: stretch;
}

.generator-container .api-url-wrapper input[type="url"] {
    flex-grow: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

#fetch-models-btn {
    flex-shrink: 0;
    padding: 0.6rem 1rem;
    border: 2px solid rgba(92, 124, 152, 0.68);
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background: linear-gradient(180deg, rgba(29, 48, 68, 0.9) 0%, rgba(19, 34, 49, 0.96) 100%);
    color: #c6d9ea;
    cursor: pointer;
    font-weight: 700;
    font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif;
    letter-spacing: 0.05em;
    font-size: 0.88rem;
    transition: filter 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
    height: auto;
}

#fetch-models-btn:hover {
    border-color: rgba(113, 145, 172, 0.8);
    box-shadow:
        inset 0 1px 0 rgba(177, 201, 220, 0.16),
        inset 0 -1px 0 rgba(0, 0, 0, 0.62),
        0 4px 10px rgba(0, 0, 0, 0.38);
    filter: brightness(1.04);
}

#fetch-models-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.2);
    color: #7d8c9d;
    box-shadow: none;
}

#model-loading-indicator {
    margin-left: 8px;
    color: #b6cee6;
    font-size: 1.2em;
    vertical-align: middle;
}

.generator-container .form-group .input-hint {
    font-size: 0.83rem;
    color: #8ca2ba;
    display: block;
    margin-top: 5px;
}

.api-warning {
    background: linear-gradient(180deg, rgba(44, 69, 93, 0.34) 0%, rgba(28, 48, 67, 0.4) 100%);
    color: #cadbeb;
    border: 1px solid rgba(95, 126, 153, 0.5);
    border-radius: 3px;
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    margin-bottom: 20px;
    text-align: center;
}

/* Action Buttons */
.generator-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.72rem;
    margin-top: 1.1rem;
    padding-top: 0.95rem;
    border-top: 1px solid rgba(94, 122, 148, 0.4);
}

@media (min-width: 860px) {
    .generator-actions {
        grid-template-columns: 1.35fr 1fr;
    }
}

/* Generate Button */
#generate-tno-btn {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 0.9rem 1.3rem;
    border-radius: 2px;
    border: 2px solid rgba(104, 133, 161, 0.76);
    background:
        linear-gradient(180deg, rgba(38, 62, 86, 0.96) 0%, rgba(21, 40, 60, 0.98) 100%);
    color: #d7e8f6;
    font-size: 1.02rem;
    font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif;
    letter-spacing: 0.06em;
    font-weight: 700;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 220ms ease, filter 220ms ease, border-color 220ms ease;
    box-shadow:
        inset 0 1px 0 rgba(199, 218, 234, 0.24),
        inset 0 -1px 0 rgba(0, 0, 0, 0.68),
        inset 1px 0 0 rgba(188, 208, 223, 0.16),
        inset -1px 0 0 rgba(0, 0, 0, 0.5),
        0 6px 12px rgba(0, 0, 0, 0.46);
    margin-top: 0;
    display: block;
    width: 100%;
}

#generate-tno-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(176, 199, 219, 0.08) 0px,
            rgba(176, 199, 219, 0.08) 1px,
            transparent 1px,
            transparent 3px
        ),
        linear-gradient(180deg, rgba(167, 190, 209, 0.2) 0%, rgba(167, 190, 209, 0) 58%);
}

#generate-tno-btn::after {
    content: none;
}

#generate-tno-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(124, 157, 186, 0.9);
    box-shadow:
        inset 0 1px 0 rgba(204, 223, 238, 0.28),
        inset 0 -1px 0 rgba(0, 0, 0, 0.7),
        inset 1px 0 0 rgba(191, 212, 229, 0.18),
        inset -1px 0 0 rgba(0, 0, 0, 0.52),
        0 9px 16px rgba(0, 0, 0, 0.52);
    filter: brightness(1.05);
}

#generate-tno-btn:active {
    transform: translateY(1px);
    border-color: rgba(80, 109, 134, 0.88);
    box-shadow:
        inset 0 2px 0 rgba(0, 0, 0, 0.54),
        inset 0 -1px 0 rgba(174, 198, 219, 0.16),
        inset 1px 0 0 rgba(0, 0, 0, 0.4),
        inset -1px 0 0 rgba(169, 193, 213, 0.12);
}

#generate-tno-btn:disabled {
    background: linear-gradient(180deg, rgba(54, 60, 70, 0.9) 0%, rgba(43, 49, 58, 0.94) 100%);
    color: #9ab0c4;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    border-color: rgba(104, 122, 141, 0.34);
}

#download-tno-html-btn {
    position: relative;
    padding: 0.9rem 1.1rem;
    border-radius: 2px;
    border: 2px solid rgba(92, 121, 147, 0.72);
    background:
        linear-gradient(180deg, rgba(20, 35, 50, 0.96) 0%, rgba(14, 26, 39, 0.99) 100%);
    color: #c5d6e5;
    font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif;
    font-size: 0.96rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow:
        inset 0 1px 0 rgba(171, 193, 211, 0.16),
        inset 0 -1px 0 rgba(0, 0, 0, 0.62),
        inset 1px 0 0 rgba(171, 193, 211, 0.1),
        inset -1px 0 0 rgba(0, 0, 0, 0.5),
        0 6px 12px rgba(0, 0, 0, 0.44);
    transition: transform 220ms ease, box-shadow 220ms ease, filter 220ms ease, border-color 220ms ease;
}

#download-tno-html-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(109, 140, 169, 0.72);
    box-shadow:
        inset 0 1px 0 rgba(182, 205, 223, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.66),
        inset 1px 0 0 rgba(174, 196, 214, 0.12),
        inset -1px 0 0 rgba(0, 0, 0, 0.52),
        0 8px 14px rgba(0, 0, 0, 0.5);
    filter: brightness(1.03);
}

#download-tno-html-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow:
        inset 0 2px 0 rgba(0, 0, 0, 0.54),
        inset 0 -1px 0 rgba(171, 193, 211, 0.14);
}

#download-tno-html-btn.is-ready {
    border-color: rgba(117, 150, 179, 0.74);
    color: #d4e4f1;
    background: linear-gradient(180deg, rgba(31, 51, 71, 0.96) 0%, rgba(20, 37, 55, 0.99) 100%);
}

#download-tno-html-btn:disabled {
    opacity: 0.56;
    color: #889aac;
    border-color: rgba(100, 118, 136, 0.34);
    box-shadow: none;
}

/* Output Area */
#tno-output-area {
    position: relative;
    isolation: isolate;
    margin-top: 1.5rem;
    border: 2px solid rgba(87, 114, 138, 0.76);
    border-radius: 3px;
    background: linear-gradient(180deg, rgba(10, 18, 27, 0.98) 0%, rgba(7, 13, 21, 1) 100%);
    padding: 0.96rem 0.9rem 0.9rem;
    min-height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(177, 200, 218, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.66),
        inset 1px 0 0 rgba(168, 190, 208, 0.08),
        inset -1px 0 0 rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(6, 11, 18, 0.72),
        0 10px 18px rgba(0, 0, 0, 0.56);
}

#tno-output-area::before {
    content: 'TRANSMISSION BUFFER';
    position: absolute;
    top: 0.65rem;
    left: 0.78rem;
    font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    color: #a8bed1;
    opacity: 0.92;
    text-shadow: 0 0 4px rgba(148, 186, 214, 0.28);
}

#tno-output-area::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 44%, rgba(0, 0, 0, 0) 56%, rgba(0, 0, 0, 0.42) 100%),
        repeating-linear-gradient(
            to bottom,
            rgba(150, 177, 198, 0.08) 0px,
            rgba(150, 177, 198, 0.08) 1px,
            transparent 1px,
            transparent 3px
        ),
        repeating-radial-gradient(
            circle at 0 0,
            rgba(191, 210, 225, 0.06) 0 1px,
            transparent 1px 6px
        );
    z-index: 0;
}

#tno-output-area > * {
    position: relative;
    z-index: 1;
}

#tno-loading-indicator,
#tno-error-message {
    display: none;
    text-align: center;
    padding: 20px;
}

#tno-loading-indicator {
    color: #cddbe7;
    font-size: 1rem;
    font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif;
    letter-spacing: 0.05em;
    animation: pulse 1.4s infinite ease-in-out;
}

#tno-error-message {
    color: #dce8f2;
    background-color: rgba(46, 68, 90, 0.34);
    border: 1px solid rgba(98, 125, 150, 0.5);
    padding: 0.9rem;
    border-radius: 6px;
}

@keyframes pulse {
    0% {
        opacity: 0.55;
        transform: scale(0.99);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0.55;
        transform: scale(0.99);
    }
}

@keyframes tno-crt-scan-drift {
    0% {
        background-position: 0 0, 0 0;
    }
    100% {
        background-position: 0 16px, 100% 0;
    }
}

@keyframes tno-crt-flicker {
    0%,
    100% {
        opacity: 0.2;
    }
    40% {
        opacity: 0.17;
    }
    41% {
        opacity: 0.23;
    }
    42% {
        opacity: 0.18;
    }
    70% {
        opacity: 0.19;
    }
}

@keyframes tno-fade-up {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.generator-hero {
    animation: tno-fade-up 460ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.generator-container {
    animation: tno-fade-up 560ms cubic-bezier(0.22, 1, 0.36, 1) 80ms both;
}

#tno-output-area {
    animation: tno-fade-up 580ms cubic-bezier(0.22, 1, 0.36, 1) 160ms both;
}

/* --- TNO Screenshot Styles --- */
body.tno-preview-active {
    background: radial-gradient(circle at 50% -20%, #354b67 0%, #1f2b3c 35%, #151c26 100%);
}

.tno-ui-wrapper {
    position: relative;
    width: 100%;
    max-width: none;
    min-height: 740px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 2px;
    border: 2px solid rgba(128, 164, 191, 0.72);
    outline: 1px solid rgba(14, 27, 40, 0.9);
    background: linear-gradient(180deg, #2a3643 0%, #1d2a37 44%, #151f2a 100%);
    box-shadow:
        inset 0 1px 0 rgba(182, 206, 223, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.7),
        inset 1px 0 0 rgba(176, 198, 216, 0.1),
        inset -1px 0 0 rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(6, 12, 19, 0.74),
        inset 0 0 34px rgba(4, 9, 15, 0.46),
        0 20px 30px rgba(0, 0, 0, 0.62);
}

.tno-ui-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 10px 10px, rgba(186, 206, 222, 0.7) 0 1px, rgba(15, 29, 42, 0.92) 2px, transparent 3px),
        radial-gradient(circle at calc(100% - 10px) 10px, rgba(186, 206, 222, 0.7) 0 1px, rgba(15, 29, 42, 0.92) 2px, transparent 3px),
        radial-gradient(circle at 10px calc(100% - 10px), rgba(186, 206, 222, 0.7) 0 1px, rgba(15, 29, 42, 0.92) 2px, transparent 3px),
        radial-gradient(circle at calc(100% - 10px) calc(100% - 10px), rgba(186, 206, 222, 0.7) 0 1px, rgba(15, 29, 42, 0.92) 2px, transparent 3px),
        repeating-linear-gradient(
            to bottom,
            rgba(165, 190, 211, 0.1) 0px,
            rgba(165, 190, 211, 0.1) 1px,
            transparent 1px,
            transparent 3px
        ),
        repeating-linear-gradient(
            to right,
            rgba(109, 138, 161, 0.05) 0px,
            rgba(109, 138, 161, 0.05) 1px,
            transparent 1px,
            transparent 6px
        );
    opacity: 0.5;
    z-index: 0;
}

.tno-ui-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, 0.52) 100%),
        linear-gradient(180deg, rgba(175, 198, 216, 0.04) 0%, rgba(175, 198, 216, 0) 18%, rgba(0, 0, 0, 0.2) 100%);
}

/* .tno-ui-wrapper.modal-active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 5;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
} */

.tno-main-screen {
    display: flex;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.left-column {
    width: 500px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(35, 46, 58, 0.98) 0%, rgba(24, 34, 46, 0.99) 100%);
    border-right: 2px solid #141c25;
    padding: 10px;
    gap: 8px;
    box-shadow:
        inset -1px 0 0 rgba(255, 255, 255, 0.04),
        inset 0 0 0 1px rgba(5, 10, 16, 0.64),
        inset 0 0 22px rgba(5, 10, 16, 0.34);
}

/* --- New Country Panel Styles --- */
.country-panel {
    background: linear-gradient(180deg, #2d3944 0%, #232f3a 100%);
    border: 1px solid rgba(158, 188, 214, 0.28);
    border-radius: 2px;
    overflow: hidden;
    color: #e0e0e0;
    font-family: 'Noto Sans SC', sans-serif;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    box-shadow:
        inset 0 1px 0 rgba(172, 194, 210, 0.08),
        inset 0 0 0 1px rgba(6, 11, 17, 0.62),
        0 8px 14px rgba(4, 9, 15, 0.5);
}

.country-panel-header {
    display: flex;
    align-items: center;
    background:
        linear-gradient(180deg, #26323f 0%, #1f2934 100%);
    padding: 4px;
    border-bottom: 1px solid rgba(146, 175, 204, 0.24);
    box-shadow:
        inset 0 -1px 0 rgba(255, 255, 255, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.header-left-icons {
    display: flex;
    margin-right: 8px;
}

.country-flag-container {
    width: 60px;
    height: 40px;
    background-color: #000;
    border: 1px solid #111;
    padding: 2px;
    box-sizing: border-box;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 0 4px 1px rgba(0,0,0,0.5);
}

.country-flag-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.05) 0, rgba(255,255,255,0.05) 1px, transparent 1px, transparent 2px);
    z-index: 2;
}

.ideology-icon-container {
    width: 40px;
    height: 40px;
    background-color: #111;
    border: 1px solid #1a1f25;
    border-left: none;
}
#tno-ideology-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#tno-flag-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(0.4px) saturate(0.8);
    transform: scale(1.05);
    opacity: 0.9;
}

.country-name-area {
    flex-grow: 1;
    font-size: 0.9em;
    font-weight: 600;
    font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif;
    letter-spacing: 0.04em;
    line-height: 1.3;
    text-align: left;
    padding: 0 8px;
    color: #d8eaf9;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}

.country-faction-logo {
    width: 40px;
    height: 40px;
    background-color: #111;
    border: 1px solid #1a1f25;
}
#tno-faction-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.country-panel-body {
    display: flex;
    padding: 8px;
    gap: 8px;
    border-top: 1px solid rgba(147, 177, 203, 0.22);
    align-items: flex-start;
    background:
        linear-gradient(180deg, rgba(30, 40, 52, 0.95) 0%, rgba(25, 34, 44, 0.98) 100%);
}

.leader-portrait {
    flex-shrink: 0;
    width: 130px;
    height: 160px; /* Set a fixed height */
    border: 1px solid #1a1f25;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
    background-color: #222;
    /* New styles for background image approach */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
#tno-leader-portrait {
   display: none !important; /* Hide the img element itself */
}

.right-content-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #2d3945 0%, #25303c 100%);
    border: 1px solid rgba(142, 172, 198, 0.3);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
    padding: 8px;
    gap: 8px;
    border-radius: 2px;
}

.politics-main-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.political-pie-chart {
    width: 84px;
    height: 84px;
    padding: 2px;
    flex-shrink: 0;
    border: 2px solid #121920;
    border-top-color: #34485c;
    border-left-color: #34485c;
    background-color: #24292e;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow:
        inset 0 0 10px rgba(0, 0, 0, 0.62),
        0 0 0 1px rgba(198, 224, 247, 0.09),
        0 0 14px rgba(5, 14, 24, 0.22);
    cursor: pointer;
}

.politics-details {
    text-align: left;
    flex-grow: 1;
    padding: 4px 0;
}
.party-name, .party-ideology, .next-election {
    font-size: 0.9em;
    line-height: 1.3;
    writing-mode: horizontal-tb !important;
}
.party-name {
    font-weight: 700;
    font-size: 1em;
    color: #eaf5ff;
    font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
    letter-spacing: 0.02em;
}
.party-ideology, .next-election {
    color: #c3d5e6;
}

.horizontal-divider {
    border-bottom: 1px solid rgba(138, 164, 191, 0.32);
    width: 100%;
    margin: 4px 0;
}

.country-panel-footer {
    display: flex;
    align-items: stretch; /* Make items same height */
    gap: 8px;
}

.focus-icon-container {
    width: 56px;
    height: 56px;
    background: linear-gradient(180deg, #242d39 0%, #1f2631 100%);
    border: 2px solid #111;
    border-top-color: #333;
    border-left-color: #333;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 2px;
}
#tno-focus-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.focus-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    padding: 10px;
    font-size: 1.1em;
    font-weight: 700;
    color: #ecf6ff;
    font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif;
    letter-spacing: 0.04em;
    cursor: pointer;
    border: 1px solid rgba(121, 180, 232, 0.72);
    background: linear-gradient(180deg, rgba(50, 64, 80, 0.92) 0%, rgba(35, 47, 61, 0.95) 100%);
    text-align: center;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 1px;
}

.focus-button::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    height: 6px;
    background-color: rgba(121, 180, 232, 0.24);
    border-radius: 1px;
}

.focus-button::before {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 2px;
    width: 75%; /* Example progress */
    height: 6px;
    background: linear-gradient(90deg, #6eb7f2 0%, #ffc680 100%);
    border-radius: 3px;
    z-index: 1;
}

.focus-button:hover {
    filter: brightness(1.06);
}

.left-section { border-bottom: 1px solid #1a1f25; padding: 8px; background-color: #31373f; }
.left-section-darker { background-color: #2a2e34; }
.left-section-darkest { background-color: #24292e; }

.leader-info { display: flex; align-items: center; padding-bottom: 10px; }
.leader-portrait { flex-shrink: 0; cursor: pointer; }
#tno-leader-portrait { width: 90px; height: 115px; object-fit: cover; border: 1px solid #4a5562; margin-right: 10px; filter: grayscale(10%) brightness(1.0); background-color: #222; display: block; }
.leader-details { flex-grow: 1; }
.leader-name { font-family: 'Noto Sans SC', sans-serif; font-weight: 700; color: #e0e0e0; font-size: 1.2em; margin-bottom: 5px; }
.leader-trait { display: flex; align-items: center; font-size: 0.9em; color: #a0a0a0; margin-top: 8px;}
.trait-icon { width: 20px; height: 20px; border: 1px solid #ccc; background-color: #eee; color: #333; margin-right: 5px; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0;}
.trait-text { font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif; color:#c0d0e0; }

.national-focus-panel { padding: 0; }
.nf-title-bar { background: linear-gradient(to bottom, #5a7a9a, #4a6a8a); padding: 5px 10px; font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif; font-weight: 700; color: #e0f0ff; font-size: 1.1em; text-align: center; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid #2a4a6a; }
.nf-content { padding: 10px; background-color: #31373f; }
.nf-main-focus { display: flex; align-items: center; margin-bottom: 10px; padding-bottom: 10px; }
.nf-main-icon { width: 50px; height: 50px; border: 1px solid #B0E0E6; margin-right: 10px; flex-shrink: 0; background-color: #222; display: flex; justify-content: center; align-items: center; }
#tno-focus-icon-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.nf-main-details .title { font-family: 'Noto Serif SC', serif; font-weight: 700; color: #f0f8ff; font-size: 1.1em; margin-bottom: 3px; }
.nf-main-details .description { font-size: 0.85em; color: #b0c4de; line-height: 1.3; }

.national-spirits-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px; /* Space between icons */
    padding: 8px 0;
    border-top: 1px solid #1a1f25;
}

.national-spirit-icon {
    width: 52px;
    height: 52px;
    background-color: #24292e;
    border: 1px solid #1a1f25;
    padding: 2px;
    box-sizing: border-box;
    cursor: pointer;
    position: relative;
    transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.national-spirit-icon:hover {
    transform: translateY(-2px);
    border-color: rgba(171, 208, 238, 0.7);
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.35);
}

.national-spirit-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.national-spirit-icon.loading::after,
.national-spirit-icon.error::after {
    content: '⏳';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: #888;
}

.national-spirit-icon.error::after {
    content: '❌';
    color: #a83232;
}


.political-info { font-size: 0.9em; color: #b0b0b0; padding: 10px; }
.political-info .party-info { display: flex; align-items: center; margin-bottom: 5px; }
.party-icon { width: 22px; height: 22px; border: 1px solid #ccc; background-color: #eee; color: #333; margin-right: 8px; flex-shrink: 0; text-align: center; line-height: 20px;}
.political-info .party-name { font-weight: 700; color: #E0FFFF; }
.political-info .party-ideology, .political-info .next-election { padding-left: 30px; margin-bottom: 3px; }
.political-info .next-election span { color: #AFEEEE; font-weight: normal;}

.political-pie { padding: 10px; }
.political-pie .political-pie-chart {
    position: relative; /* Needed for the overlay */
    display: block;
    margin: 5px auto;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 1px solid #444;
    background-color: #222;
    cursor: pointer;
    box-shadow:
        inset 0 0 15px 5px rgba(0,0,0,0.75), /* Inner shadow for depth */
        0 0 10px 2px rgba(173, 216, 230, 0.2); /* Faint outer glow */
    overflow: hidden; /* Hide the overlay overflow */
}

.political-pie .political-pie-chart::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.25) 0px,
        rgba(0, 0, 0, 0.25) 1px,
        transparent 1px,
        transparent 3px
    );
    z-index: 1;
    border-radius: 50%;
}

.flag-stats { display: flex; align-items: center; padding: 10px; }
.flag-stats #tno-flag-img { width: 70px; height: auto; margin-right: 10px; border: 1px solid #555; background-color: #222; display: block; }
.stats-text { font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif; font-size: 1.1em; color: #c0c0c0; line-height: 1.3; font-weight: 700; }
.stats-text span { display: inline-block; margin-left: 5px; font-weight: normal; color: #eee; }

/* --- Draggable Window Styles --- */
.tno-draggable-window {
    position: absolute;
    z-index: 9;
    background-color: #2d343c;
    border: 1px solid rgba(161, 188, 212, 0.42);
    box-shadow:
        0 16px 30px rgba(0, 0, 0, 0.48),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 0 0 2px rgba(16, 24, 35, 0.68);
    animation: window-rise 620ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

#tno-newspaper-window {
    animation-delay: 60ms;
}

#tno-event-window {
    animation-delay: 130ms;
}

.window-header {
    padding: 6px 10px;
    cursor: move;
    z-index: 10;
    background-color: #1a1f25;
    color: #e0e0e0;
    font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif;
    font-weight: 700;
    text-align: center;
}

/* --- Newspaper Window Specific Styles --- */
.newspaper-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(592px, calc(100% - 2rem));
    background:
        linear-gradient(180deg, rgba(252, 247, 236, 0.94) 0%, rgba(244, 236, 222, 0.96) 100%),
        url('/textures/parchment-paper.jpg') center/cover no-repeat;
    border: 1px solid #baaa8f;
    box-shadow:
        0 16px 34px rgba(0, 0, 0, 0.44),
        0 0 0 2px rgba(54, 46, 33, 0.32);
    color: #1a1a1a;
    font-family: 'Noto Serif SC', serif;
    display: flex;
    flex-direction: column;
    border-radius: 4px;
    overflow: hidden;
}

.newspaper-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    background-color: rgba(232, 228, 217, 0.9);
    padding: 6px 12px;
    border-bottom: 2px solid #111;
}

.header-left {
    font-family: 'Times New Roman', Times, serif;
    font-size: 10px;
    text-transform: uppercase;
    line-height: 1.1;
}
.four-star {
    font-size: 14px;
    letter-spacing: 2px;
    color: #000;
}

.header-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 28px;
    line-height: 1;
    text-align: center;
    color: #000;
}

.header-right .price {
    font-family: 'Times New Roman', Times, serif;
    font-size: 18px;
    font-weight: bold;
}

.newspaper-top-line {
    background-color: #e8e4d9;
    text-align: center;
    padding: 2px 0;
    border-bottom: 1px solid #000;
}
.city-final {
    font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 1px;
    color: #000;
}

.newspaper-body {
    padding: 16px 18px;
}

.newspaper-headline {
    font-family: 'Noto Serif SC', serif;
    font-weight: 700;
    font-size: 34px;
    text-align: center;
    margin: 0 0 15px 0;
    line-height: 1.2;
    color: #000;
}

.newspaper-main-content {
    display: flex;
}

.newspaper-article {
    display: flex;
    gap: 15px;
}

.article-image-container {
    width: 40%;
    max-width: 220px;
    flex-shrink: 0;
    border: 1px solid #ccc;
    box-sizing: border-box;
    aspect-ratio: 2 / 3;
    position: relative;
}
#tno-newspaper-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the area, cropping if necessary */
    display: block;
    filter: grayscale(100%) contrast(1.1);
}

.article-text {
    font-size: 13.5px;
    line-height: 1.6;
    text-align: justify;
    flex-grow: 1;
    color: #26211b;
}
.article-text p {
    margin-top: 0;
    margin-bottom: 1em;
    break-inside: avoid-column;
}

.newspaper-footer {
    padding: 12px;
    background-color: rgba(232, 228, 217, 0.9);
    border-top: 1px solid #ccc;
    margin-top: auto;
}

.newspaper-option-button {
    width: 100%;
    padding: 10px;
    background: linear-gradient(180deg, #dfd7c9 0%, #d1c7b7 100%);
    border: 1px solid #a89f8f;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.5);
    text-align: center;
    font-family: 'Noto Sans SC', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #000;
    cursor: pointer;
    transition: background-color 0.2s;
}
.newspaper-option-button:hover {
    filter: brightness(0.97);
}

/* --- New Event Window Styles --- */
.tno-event-new-style {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(860px, calc(100% - 2rem));
    background:
        linear-gradient(180deg, rgba(30, 36, 43, 0.96) 0%, rgba(22, 28, 35, 0.96) 100%),
        url('/textures/noir-paper.jpg') center/cover no-repeat;
    border: 1px solid rgba(172, 198, 222, 0.44);
    box-shadow:
        0 0 0 2px rgba(26, 34, 44, 0.92),
        0 0 0 5px rgba(13, 19, 27, 0.64),
        0 0 30px rgba(0, 0, 0, 0.68);
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-radius: 4px;
}

.tno-event-new-style .event-title-bar {
    background: linear-gradient(180deg, #202833 0%, #1a212b 100%);
    color: #ecf6ff;
    text-align: center;
    padding: 7px 0;
    font-family: 'Orbitron', 'Noto Sans SC', sans-serif;
    font-size: 1.2em;
    font-weight: 700;
    letter-spacing: 0.07em;
    border: 1px solid #0f141b;
    border-bottom: 1px solid rgba(156, 188, 215, 0.35);
    margin-bottom: 10px;
    cursor: move;
    text-transform: uppercase;
}

.tno-event-new-style .event-title-bar h1 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
}

.tno-event-new-style .event-screen {
    background-color: #000;
    border: 2px solid #1f2a36;
    border-top-color: #4a5f74;
    border-left-color: #4a5f74;
    padding: 15px;
    border-radius: 6px;
    overflow: hidden;
}

.tno-event-new-style .event-image-section {
    position: relative;
    background-color: #111;
    line-height: 0;
}

.tno-event-new-style #tno-event-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    filter: grayscale(30%) contrast(1.08) saturate(0.84);
    opacity: 0.92;
}

.image-overlay-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(180, 220, 180, 0.15) 0,
        rgba(180, 220, 180, 0.15) 1px,
        transparent 1px,
        transparent 3px
    );
    z-index: 1;
}

.tno-event-new-style .quote-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 18px 32px;
    box-sizing: border-box;
    z-index: 2;
    color: #f9f4eb;
    font-family: 'Noto Serif SC', Georgia, serif;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.75) 40%, transparent 100%);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
}

.tno-event-new-style .quote-overlay p {
    margin: 0 0 8px 0;
    line-height: 1.5;
    font-size: 1.32em;
    font-style: normal;
}

.tno-event-new-style .quote-overlay .attribution {
    text-align: right;
    font-style: normal;
    font-size: 1.1em;
    color: #ddd;
    margin: 0;
}

.tno-event-new-style .event-main-content {
    padding: 15px;
    font-family: 'Noto Sans SC', sans-serif;
    font-size: 0.98em;
    line-height: 1.6;
    text-align: justify;
    color: #d1e2f2;
    background: linear-gradient(180deg, rgba(14, 20, 29, 0.65) 0%, rgba(17, 23, 34, 0.72) 100%);
    margin-top: 10px;
    border-radius: 4px;
    border: 1px solid rgba(130, 158, 183, 0.22);
}

.tno-event-new-style .event-options-area {
    padding-top: 15px;
    display: flex;
    justify-content: center;
}

.tno-event-new-style .event-option-button {
    padding: 8px 40px;
    background: linear-gradient(180deg, rgba(54, 70, 88, 0.9) 0%, rgba(43, 57, 73, 0.95) 100%);
    border: 1px solid rgba(149, 183, 214, 0.5);
    border-radius: 1px;
    color: #e7f4ff;
    font-family: 'Share Tech Mono', 'Noto Sans SC', sans-serif;
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.tno-event-new-style .event-option-button:hover {
    filter: brightness(1.08);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.34);
}

@keyframes window-rise {
    0% {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.97);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .generator-hero,
    .generator-container,
    .generator-container::before,
    .generator-container::after,
    #tno-output-area,
    .tno-draggable-window,
    .national-spirit-icon,
    #generate-tno-btn,
    #generate-tno-btn::after {
        animation: none !important;
        transition-duration: 1ms !important;
    }
}

/* --- Responsive Styles --- */
@media (max-width: 1260px) {
    .tno-ui-wrapper {
        min-height: auto;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.9rem;
        padding: 0.8rem;
        overflow: visible;
    }

    .tno-main-screen {
        position: relative;
        height: auto;
        min-height: 0;
    }

    .left-column {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(152, 181, 207, 0.22);
        border-radius: 2px;
    }

    .tno-draggable-window {
        position: relative;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: 100%;
        max-width: none;
    }

    .newspaper-header-bar,
    .tno-event-new-style .event-title-bar {
        cursor: default;
        touch-action: pan-y;
    }
}

@media (max-width: 920px) {
    .newspaper-article {
        flex-direction: column;
    }

    .article-image-container {
        width: 100%;
        max-width: none;
        aspect-ratio: 16 / 10;
    }

    .tno-event-new-style .quote-overlay {
        padding: 14px 16px;
    }

    .tno-event-new-style .quote-overlay p {
        font-size: 1.06rem;
    }
}

@media (max-width: 768px) {
    .generator-container {
        padding: 0.95rem;
        border-radius: 4px;
    }

    .generator-form-grid {
        gap: 0.95rem;
    }

    .generator-form-grid .form-group {
        padding: 0.78rem 0.78rem 0.84rem;
    }

    .generator-form-grid .form-group textarea {
        min-height: 108px;
    }

    .generator-container .form-group input[type="text"],
    .generator-container .form-group input[type="url"],
    .generator-container .form-group input[type="password"],
    .generator-container .form-group textarea,
    .generator-container .form-group select {
        font-size: 16px;
    }

    .generator-container .api-url-wrapper {
        flex-direction: column;
        gap: 0.6rem;
    }

    .generator-container .api-url-wrapper input[type="url"] {
        border-radius: 2px;
        border-right: 1px solid rgba(122, 174, 216, 0.42);
    }

    #fetch-models-btn {
        border-left: 1px solid rgba(118, 183, 228, 0.4);
        border-radius: 2px;
    }

    .generator-actions {
        padding-top: 0.75rem;
        gap: 0.58rem;
    }

    #generate-tno-btn,
    #download-tno-html-btn {
        min-height: 46px;
        font-size: 0.97rem;
        letter-spacing: 0.04em;
    }

    #tno-output-area {
        margin-top: 1rem;
        padding: 1rem 0.64rem calc(0.72rem + env(safe-area-inset-bottom, 0px));
    }

    .tno-ui-wrapper {
        padding: 0.62rem;
        gap: 0.62rem;
        border-radius: 4px;
        touch-action: pan-y pinch-zoom;
    }

    .left-column {
        border-radius: 2px;
        padding: 0.56rem;
        gap: 0.56rem;
    }

    .country-panel-header {
        padding: 4px 6px;
    }

    .country-panel-body {
        padding: 6px;
        gap: 6px;
    }

    #tno-output-area::before {
        font-size: 0.67rem;
        top: 0.56rem;
        left: 0.64rem;
        letter-spacing: 0.11em;
    }

    .country-panel-body {
        flex-direction: column;
    }

    .leader-portrait {
        width: 100%;
        max-width: 220px;
        height: 210px;
        margin-inline: auto;
    }

    .right-content-area {
        width: 100%;
    }

    .politics-main-area {
        flex-direction: column;
        align-items: flex-start;
    }

    .political-pie-chart {
        width: 78px;
        height: 78px;
    }

    .national-spirits-container {
        gap: 5px;
        padding: 6px 0 2px;
    }

    .national-spirit-icon {
        width: 48px;
        height: 48px;
    }

    .focus-icon-container {
        width: 52px;
        height: 52px;
    }

    .focus-button {
        min-height: 54px;
        font-size: 0.95rem;
        padding: 8px 8px 15px;
    }

    .newspaper-header-bar {
        padding: 5px 8px;
    }

    .header-title {
        font-size: 1.24rem;
    }

    .header-right .price {
        font-size: 1.05rem;
    }

    .newspaper-body {
        padding: 0.78rem;
    }

    .newspaper-headline {
        font-size: clamp(1.3rem, 6vw, 1.9rem);
        margin-bottom: 0.65rem;
    }

    .article-text {
        font-size: 0.94rem;
        line-height: 1.54;
    }

    .newspaper-footer {
        padding: 0.6rem;
    }

    .newspaper-option-button {
        padding: 0.62rem 0.7rem;
        font-size: 0.98rem;
    }

    .tno-event-new-style {
        padding: 0.62rem;
    }

    .tno-event-new-style .event-title-bar {
        margin-bottom: 0.62rem;
        padding: 0.52rem 0.4rem;
        font-size: 1rem;
    }

    .tno-event-new-style .event-screen {
        padding: 0.64rem;
    }

    .tno-event-new-style .quote-overlay {
        padding: 0.76rem 0.8rem;
    }

    .tno-event-new-style .quote-overlay p {
        margin: 0 0 0.3rem 0;
        font-size: 0.96rem;
        line-height: 1.46;
    }

    .tno-event-new-style .quote-overlay .attribution {
        font-size: 0.82rem;
    }

    .tno-event-new-style .event-main-content {
        font-size: 0.92rem;
        margin-top: 0.58rem;
        padding: 0.7rem;
    }

    .tno-event-new-style .event-options-area {
        padding-top: 0.68rem;
    }

    .tno-event-new-style .event-option-button {
        width: 100%;
        padding: 0.62rem 0.85rem;
        font-size: 0.96rem;
    }
}

@media (max-width: 540px) {
    .generator-container {
        padding: 0.78rem;
        border-radius: 3px;
    }

    #generate-tno-btn,
    #download-tno-html-btn {
        min-height: 44px;
        font-size: 0.92rem;
    }

    #tno-output-area {
        padding: 0.9rem 0.45rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
    }

    .tno-ui-wrapper {
        padding: 0.46rem;
        gap: 0.5rem;
        border-radius: 3px;
    }

    .left-column {
        padding: 0.46rem;
        gap: 0.46rem;
    }

    .country-flag-container {
        width: 52px;
        height: 34px;
    }

    .ideology-icon-container,
    .country-faction-logo {
        width: 34px;
        height: 34px;
    }

    .country-name-area {
        font-size: 0.77rem;
        padding: 0 5px;
    }

    .leader-portrait {
        height: min(196px, 54vw);
    }

    .politics-main-area {
        gap: 6px;
    }

    .political-pie-chart {
        width: 70px;
        height: 70px;
    }

    .party-name,
    .party-ideology,
    .next-election {
        font-size: 0.82rem;
    }

    .national-spirit-icon {
        width: 44px;
        height: 44px;
    }

    .focus-button {
        min-height: 50px;
        font-size: 0.9rem;
    }

    .newspaper-header-bar {
        padding: 4px 6px;
    }

    .article-text {
        font-size: 0.87rem;
        line-height: 1.48;
    }

    .generator-form-grid .form-group {
        border-radius: 2px;
    }

    .country-panel-footer {
        flex-direction: column;
    }

    .focus-icon-container {
        width: 100%;
        height: 72px;
    }

    .focus-button {
        min-height: 62px;
        padding: 0.7rem 0.8rem 0.9rem;
        font-size: 1rem;
    }

    .newspaper-headline {
        font-size: 1.35rem;
    }

    .header-title {
        font-size: 1.12rem;
    }

    .tno-event-new-style {
        padding: 0.56rem;
    }

    .tno-event-new-style .event-screen {
        padding: 0.56rem;
    }

    .tno-event-new-style .quote-overlay {
        padding: 0.62rem 0.68rem;
    }

    .tno-event-new-style .quote-overlay p {
        font-size: 0.86rem;
    }

    .tno-event-new-style .quote-overlay .attribution {
        font-size: 0.74rem;
    }

    .tno-event-new-style .event-option-button {
        width: 100%;
    }

    #tno-output-area::before {
        font-size: 0.62rem;
        opacity: 0.8;
    }
}

/* --- Tooltip Styles --- */
.tno-tooltip {
    position: fixed;
    z-index: 9999;
    display: none;
    font-family: 'Noto Sans SC', sans-serif;
    color: #d6e8f9;
    background: linear-gradient(180deg, rgba(22, 34, 48, 0.92) 0%, rgba(17, 27, 39, 0.95) 100%);
    border: 1px solid rgba(123, 178, 228, 0.8);
    border-radius: 8px;
    width: min(400px, calc(100vw - 24px));
    pointer-events: none;
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.42);
    padding: 12px;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.tooltip-content-wrapper {
    display: flex;
    flex-direction: column;
}

.tooltip-title {
    font-size: 1.2em;
    font-weight: 700;
    color: #ffffff;
    text-align: left;
    padding-bottom: 2px;
}

.tooltip-divider {
    border-bottom: 1px dashed rgba(123, 178, 228, 0.75);
    margin: 8px 0;
    opacity: 0.6;
}

.tooltip-subtitle {
    font-size: 1.0em;
    font-weight: normal;
    color: #f0f0f0;
    text-align: left;
    margin-bottom: 12px;
}

.tooltip-image-container {
    width: 100%;
    max-height: 150px;
    background-color: #111;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid rgba(123, 178, 228, 0.35);
}
.tooltip-image-container.spirit-icon {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    margin-right: 12px;
    margin-bottom: 0;
}
.tooltip-image-container.loading::after {
    content: '⏳';
    position: absolute;
    font-size: 2rem;
    color: #888;
    animation: pulse 1.5s infinite ease-in-out;
}
.tooltip-image-container.error::after {
    content: '❌';
    position: absolute;
    font-size: 2rem;
    color: #a83232;
}

#tooltip-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(15%) contrast(1.05);
    opacity: 0.9;
}

.tooltip-image-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.15) 0px, rgba(0, 0, 0, 0.15) 1px, transparent 1px, transparent 3px);
    pointer-events: none;
    z-index: 1;
}

.tooltip-description {
    font-size: 0.95em;
    line-height: 1.6;
    text-align: justify;
}

.tooltip-description p {
    margin: 0 0 1em 0;
}
.tooltip-description p:last-child {
    margin-bottom: 0;
}

.tooltip-flavor-text {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px dashed rgba(123, 178, 228, 0.32);
    font-style: italic;
    color: #aec5d8;
    text-align: right;
}

.tooltip-modifiers {
    margin: 0;
    padding: 0 0 0 1rem;
    font-size: 0.88rem;
    line-height: 1.45;
    color: #d8e9f9;
}

.tooltip-modifiers li + li {
    margin-top: 0.2rem;
}

/* --- Fullscreen Mode Styles --- */
.tno-ui-wrapper:fullscreen {
    /* By setting a fixed aspect ratio (like 1920x1080), the browser will
       automatically letterbox the content to fit the screen, preserving the layout. */
    width: 1920px !important;
    height: 1080px !important;
    /* These values force the element to center within the fullscreen view. */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    background-color: #000; /* Black background for letterboxing */
}
