:root {
    --bg-color: #050510;
    --panel-bg: rgba(15, 20, 35, 0.75);
    --primary-cyan: #00f3ff;
    --secondary-pink: #d946ef;
    --alert-red: #ff3333;
    --warning-yellow: #facc15;
    --text-color: #e2e8f0;
    --grid-line: rgba(0, 243, 255, 0.05);
    --font-main: 'Inter', 'Noto Sans JP', sans-serif;
    --font-display: 'Orbitron', 'Inter', sans-serif;
    --glass-border: 1px solid rgba(0, 243, 255, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow-x: hidden;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 50% 0%, #1a1a3a 0%, transparent 60%),
        linear-gradient(0deg, transparent 24%, var(--grid-line) 25%, var(--grid-line) 26%, transparent 27%, transparent 74%, var(--grid-line) 75%, var(--grid-line) 76%, transparent 77%, transparent),
        linear-gradient(90deg, transparent 24%, var(--grid-line) 25%, var(--grid-line) 26%, transparent 27%, transparent 74%, var(--grid-line) 75%, var(--grid-line) 76%, transparent 77%, transparent);
    background-size: 100% 100%, 60px 60px, 60px 60px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Changed from center to allow scrolling for tall content */
}

a {
    text-decoration: none;
    color: inherit;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Back Button */
.back-btn-fixed {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    text-decoration: none;
    background: rgba(0, 5, 10, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid var(--primary-cyan);
    color: var(--primary-cyan);
    font-family: var(--font-display);
    font-size: 0.85rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.back-btn-fixed:hover {
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.3);
}

/* Main Container */
.container {
    width: 100%;
    max-width: 1400px;
    /* Wider for 2 columns */
    margin-top: 60px;
    /* Space for back button/header */
    margin-bottom: 40px;
    background: var(--panel-bg);
    border: var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

h1 {
    font-family: var(--font-display);
    font-size: 2.0rem;
    font-weight: 700;
    color: var(--primary-cyan);
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
    letter-spacing: 1px;
    margin: 0;
}

.subtitle {
    font-size: 0.8rem;
    color: var(--secondary-pink);
    vertical-align: super;
    font-weight: 400;
    opacity: 0.9;
    margin-left: 10px;
}

/* Grid Layout */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    height: calc(100vh - 250px);
    /* Fill remaining height */
    min-height: 600px;
}

.column {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.column-header h2 {
    font-family: var(--font-display);
    font-size: 1.0rem;
    color: var(--secondary-pink);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.scrollable-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-cyan) rgba(0, 0, 0, 0.2);
}

.scrollable-content::-webkit-scrollbar {
    width: 6px;
}

.scrollable-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.scrollable-content::-webkit-scrollbar-thumb {
    background-color: var(--primary-cyan);
    border-radius: 6px;
}

/* Forms */
.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--primary-cyan);
    font-family: var(--font-display);
}

.help-text {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 8px;
}

input[type="text"],
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 12px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: "Noto Sans JP", monospace;
    transition: all 0.3s;
}

textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

textarea.list-input {
    min-height: 150px;
    font-family: monospace;
}

input[type="text"]:focus,
textarea:focus {
    border-color: var(--primary-cyan);
    background: rgba(0, 0, 0, 0.5);
    outline: none;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cyber-btn {
    background: transparent;
    border: 1px solid var(--primary-cyan);
    color: var(--primary-cyan);
    padding: 8px 16px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.cyber-btn:hover {
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
    text-shadow: 0 0 5px var(--primary-cyan);
}

.cyber-btn.primary {
    background: rgba(0, 243, 255, 0.1);
}

.cyber-btn.primary:hover {
    background: var(--primary-cyan);
    color: #000;
}

.cyber-btn.danger {
    border-color: var(--alert-red);
    color: var(--alert-red);
}

.cyber-btn.danger:hover {
    background: rgba(255, 51, 51, 0.2);
    box-shadow: 0 0 15px rgba(255, 51, 51, 0.4);
}

.cyber-btn.large {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    margin-top: 20px;
}

/* Preview Area */
#preview-area {
    width: 100%;
    height: 100%;
    background: #0d1117;
    color: #c9d1d9;
    font-family: "Menlo", "Monaco", "Courier New", monospace;
    border: 1px solid var(--glass-border);
    padding: 15px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    resize: none;
}

#preview-area:focus {
    border-color: var(--secondary-pink);
    box-shadow: 0 0 15px rgba(217, 70, 239, 0.3);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: var(--panel-bg);
    border: 1px solid var(--primary-cyan);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 0 40px rgba(0, 243, 255, 0.3);
    max-width: 500px;
    width: 90%;
    animation: slideUp 0.3s ease-out;
}

.modal p {
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

/* Toast */
#toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary-cyan);
    color: #000;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: bold;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 2000;
    pointer-events: none;
}

#toast.show {
    opacity: 1;
}

.hidden-file-input {
    display: none;
}

#print-content {
    display: none;
}

/* Responsive */
@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .column {
        height: auto;
        min-height: 500px;
        /* Give some height to input/preview */
    }

    .container {
        height: auto;
    }

    textarea {
        background: rgba(0, 0, 0, 0.3);
        /* Ensure contrast on mobile */
    }
}

@media print {
    body {
        background: white;
        color: black;
        display: block;
    }

    .container,
    header,
    #toast,
    .back-btn-fixed {
        display: none !important;
    }

    #print-content {
        display: block;
        padding: 2cm;
        font-size: 11pt;
    }

    /* Basic print styling */
    #print-content h1 {
        font-size: 18pt;
        border-bottom: 2px solid #000;
        margin-bottom: 1em;
    }

    #print-content h2 {
        font-size: 14pt;
        border-bottom: 1px solid #ccc;
        margin-top: 1.5em;
        margin-bottom: 0.5em;
    }

    #print-content ul {
        padding-left: 20px;
    }

    #print-content li {
        margin-bottom: 0.3em;
    }
}

/* Footer (Page) */
/* Footer (Page) */
footer {
    margin-top: 40px;
    text-align: center;
    font-size: 0.75rem;
    color: #64748b;
    font-family: var(--font-display);
    letter-spacing: 1px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
}

.footer-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 5px;
}

.footer-btn {
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s;
}

.footer-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.support-btn {
    border-color: var(--secondary-pink);
    color: var(--secondary-pink);
    background: rgba(217, 70, 239, 0.05);
}

.support-btn:hover {
    background: rgba(217, 70, 239, 0.15);
    box-shadow: 0 0 15px rgba(217, 70, 239, 0.3);
    color: #fff;
}
