/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;700&family=JetBrains+Mono:wght@400;700&display=swap');

/* --- CSS Variables & Theming --- */
:root {
    /* Color Palette - Cyber/Premium Feel */
    --color-bg-light: #f8fafc;
    --color-bg-dark: #0a0a0a;

    --color-surface-light: rgba(255, 255, 255, 0.8);
    --color-surface-dark: rgba(20, 20, 25, 0.8);

    --color-primary: #3b82f6;
    /* Blue 500 */
    --color-primary-glow: rgba(59, 130, 246, 0.5);

    --color-accent: #8b5cf6;
    /* Violet 500 */
    --color-accent-glow: rgba(139, 92, 246, 0.5);

    --color-text-main-light: #1e293b;
    --color-text-main-dark: #f1f5f9;

    --color-text-muted-light: #64748b;
    --color-text-muted-dark: #94a3b8;

    /* Glassmorphism */
    --glass-border-light: rgba(255, 255, 255, 0.5);
    --glass-border-dark: rgba(255, 255, 255, 0.1);
    --glass-blur: 12px;

    /* Semantic Colors (Auto-switching) */
    --color-panel-bg: var(--color-bg-light);
    --color-border-subtle: #e5e7eb;

    /* Transitions */
    --default-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html.dark {
    --color-panel-bg: var(--color-bg-dark);
    --color-border-subtle: #1f2937;
}

/* --- Global Reset & Typography --- */
html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', 'Meiryo', sans-serif;
    /* Added Japanese font fallback */
    transition: var(--default-transition);
    height: 100%;
    scrollbar-gutter: stable;
    overflow-y: auto;
    overflow-x: hidden;
}

body {
    background-color: var(--color-bg-light);
    color: #0f172a;
    /* Darker black for better contrast */
}

html.dark body {
    background-color: var(--color-bg-dark);
    color: #e2e8f0;
    /* Brighter white for better contrast */
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--default-transition);
}

ul {
    list-style: none;
    padding: 0;
}

/* --- Layout Wrappers --- */
.container {
    max-width: 1200px;
    /* Restored to standard comfortable width */
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Header & Navigation --- */
nav {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    background: rgba(235, 248, 255, 0.95);
    /* Light blue tint */
    border-bottom: 2px solid var(--color-primary);
    /* Distinct border */
    padding: 1rem 0;
    transition: var(--default-transition);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

html.dark nav {
    background: rgba(15, 23, 42, 0.95);
    /* Dark blue accents */
    border-bottom: 2px solid var(--color-primary);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #3b82f6, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px var(--color-primary-glow));
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    position: relative;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.nav-link:hover {
    color: var(--color-primary);
    background: rgba(59, 130, 246, 0.05);
}

html.dark .nav-link:hover {
    background: rgba(59, 130, 246, 0.1);
}

.indicator {
    height: 3px;
    width: 0%;
    background: var(--color-accent);
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    transition: var(--default-transition);
}

.nav-link.active .indicator {
    width: 80%;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.4rem;
    border-radius: 9999px;
    /* Pill shape */
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--default-transition);
    transform: translateY(0);
}

.btn:active {
    transform: translateY(2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    box-shadow: 0 4px 15px var(--color-primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px var(--color-primary-glow);
    filter: brightness(1.1);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--color-text-muted-light);
    color: var(--color-text-main-light);
}

html.dark .btn-secondary {
    border-color: var(--color-text-muted-dark);
    color: var(--color-text-main-dark);
}

.btn-secondary:hover {
    background: rgba(128, 128, 128, 0.1);
}

/* --- Dark Mode Switch --- */
.switch-label {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    cursor: pointer;
}

.switch-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 34px;
    transition: var(--default-transition);
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    border-radius: 50%;
    transition: var(--default-transition);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

html.dark .switch-slider {
    background-color: var(--color-accent);
}

.switch-checkbox:checked+.switch-slider:before {
    transform: translateX(24px);
}

/* --- Cards & Content Areas --- */
.card {
    background: var(--color-surface-light);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    transition: var(--default-transition);
}

body.dark .card {
    background: var(--color-surface-dark);
    border: 1px solid var(--glass-border-dark);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

body.dark .card:hover {
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7);
}

/* --- Hero Section --- */
.hero {
    position: relative;
    padding: 6rem 0;
    text-align: center;
    overflow: hidden;
    border-radius: 24px;
    margin-bottom: 3rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
}

body.dark .hero {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(139, 92, 246, 0.05));
    border: 1px solid var(--glass-border-dark);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.1;
    background: linear-gradient(to right, #3b82f6, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    /* Compatibility */
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
    animation: gradientText 5s linear infinite;
}

@keyframes gradientText {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.hero p {
    font-size: 1.25rem;
    color: var(--color-text-muted-light);
    max-width: 600px;
    margin: 0 auto 2rem;
}

html.dark .hero p {
    color: var(--color-text-muted-dark);
}

/* --- Editor --- */
.editor-container {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border-light);
}

html.dark .editor-container {
    border: 1px solid var(--glass-border-dark);
}

textarea.code-editor {
    width: 100%;
    min-height: 400px;
    background-color: #1e1e1e;
    color: #d4d4d4;
    border: none;
    padding: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}

textarea.code-editor:focus {
    box-shadow: inset 0 0 0 2px var(--color-primary);
}

/* --- Animations --- */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* HTMX Indicator */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-request.htmx-indicator {
    opacity: 1;
}

/* Loader */
.loader {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-text-muted-light);
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

html.dark .loader {
    border-color: var(--color-text-muted-dark);
    border-bottom-color: transparent;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* --- Settings List Layout (Links Page) --- */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* More space between oval items */
    background: transparent;
    /* Remove container background */
    border: none;
    max-width: 600px;
    /* Constrain width */
    margin: 0 auto;
    /* Center */
}

html.dark .settings-list {
    background: transparent;
    border: none;
}

.settings-header {
    display: none;
    /* Hide headers as requested (just YT/Discord) */
}

html.dark .settings-header {
    display: none;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 2rem;
    background: white;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border-radius: 50px;
    /* Oval shape */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 2px solid transparent;
}

html.dark .settings-item {
    background: #1e293b;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

.settings-item:hover {
    transform: translateY(-2px);
    border-color: var(--hover-color, var(--color-primary));
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

html.dark .settings-item:hover {
    background: #334155;
    border-color: var(--hover-color, var(--color-primary));
}

.settings-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 0.9rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.settings-title {
    font-weight: 500;
    font-size: 1rem;
}

.settings-desc {
    font-size: 0.85rem;
    color: var(--color-text-muted-light);
    margin-top: 2px;
}

html.dark .settings-desc {
    color: var(--color-text-muted-dark);
}

.settings-arrow {
    color: var(--color-text-muted-light);
    opacity: 0.5;
}

/* --- Utils --- */
.text-center {
    text-align: center;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.space-x-4>*+* {
    margin-left: 1rem;
}

.hidden {
    display: none;
}

/* Full-screen mode for tools like C# Tester */
.no-scroll #content.container,
.no-scroll nav .container {
    max-width: 95% !important;
    /* Unified width for alignment */
    padding: 0 1rem !important;
    margin-top: 0 !important;
}

.no-scroll footer {
    display: none;
    /* Hide footer for cleaner full-screen tool look as requested implicitly */
}