:root {
    --bg-color: #050505;
    --text-color: #e0e0e0;
    --accent-red: #8B0000;
    --accent-red-glow: rgba(139, 0, 0, 0.6);
    --gold: #C5A059;
    --gold-glow: rgba(197, 160, 89, 0.4);
    --glass-bg: rgba(10, 10, 10, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
    --tech-green: #00ff41;
    --font-heading: 'Sawarabi Mincho', serif;
    --font-body: 'Zen Old Mincho', serif;
    --font-tech: 'Share Tech Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.8;
    overflow-x: hidden;
}

/* Background Texture */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("https://www.transparenttextures.com/patterns/black-scales.png");
    opacity: 0.15;
    z-index: -2;
    pointer-events: none;
}

h1,
h2,
h3 {
    font-family: var(--font-heading);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* --- Navigation --- */
header {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 1.5rem 5%;
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.5s ease;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: 4px;
    background: linear-gradient(45deg, #fff, #999);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 3rem;
}

.nav-links a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 2px;
    position: relative;
    transition: color 0.3s;
    font-family: var(--font-heading);
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    background: var(--accent-red);
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

.system-link {
    font-family: var(--font-tech) !important;
    color: #555 !important;
}

.system-link:hover {
    color: var(--tech-green) !important;
    text-shadow: 0 0 8px rgba(0, 255, 65, 0.5);
}

/* --- Hero Section --- */
.hero {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    background: url('https://images.unsplash.com/photo-1542051841857-5f90071e7989?q=80&w=2070&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0.4) 0%, #050505 90%);
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    padding: 0 2rem;
    animation: fadeUp 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hero-logo-wrapper {
    margin-bottom: 1.5rem;
}

.main-title {
    font-size: 6rem;
    line-height: 1;
    margin-bottom: 0.5rem;
    background: linear-gradient(to bottom, #fff 0%, #aaa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
}

.kanji-title {
    font-size: 2.5rem;
    color: var(--accent-red);
    display: block;
    margin-top: -10px;
    opacity: 0.8;
}

.subtitle {
    font-size: 1rem;
    color: #aaa;
    letter-spacing: 0.3em;
    margin-bottom: 3rem;
    font-weight: 300;
}

.divider-red {
    height: 1px;
    width: 60px;
    background: var(--accent-red);
    margin: 0 auto 2.5rem auto;
    box-shadow: 0 0 10px var(--accent-red-glow);
}

.intro-text {
    font-size: 1.2rem;
    color: #ddd;
    margin-bottom: 4rem;
    font-style: italic;
    opacity: 0.9;
}

.btn-cta {
    display: inline-block;
    padding: 18px 45px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.8rem;
    letter-spacing: 3px;
    text-decoration: none;
    transition: all 0.4s ease;
    backdrop-filter: blur(5px);
}

.btn-cta:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    box-shadow: 0 0 30px var(--accent-red-glow);
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.5;
    gap: 10px;
}

.scroll-indicator span {
    font-size: 0.7rem;
    letter-spacing: 3px;
    writing-mode: vertical-rl;
}

.arrow-down {
    width: 1px;
    height: 50px;
    background: linear-gradient(to bottom, #fff, transparent);
}

/* --- Section Styling --- */
section {
    padding: 10rem 10%;
    position: relative;
    z-index: 1;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 6rem;
    color: #fff;
    letter-spacing: 0.2em;
}

.section-title::after {
    content: '';
    display: block;
    width: 40px;
    height: 2px;
    background: var(--accent-red);
    margin: 20px auto 0;
}

/* --- Hierarchy --- */
.section-dark {
    background: linear-gradient(180deg, var(--bg-color) 0%, #080808 100%);
}

.hierarchy-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.rank-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    text-align: center;
    width: 100%;
    min-width: 300px;
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
}

.rank-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.rank-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.rank-card.boss {
    background: linear-gradient(135deg, #1a1515, #0a0a0a);
    border: 1px solid rgba(139, 0, 0, 0.3);
}

.rank-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    display: block;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
}

.rank-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.rank-desc {
    font-size: 0.9rem;
    color: #888;
    font-style: italic;
}

.rank-group {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    width: 100%;
}

.divider-wood {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-red), transparent);
    opacity: 0.3;
    margin: 2rem 0;
}

.rank-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.rank-item {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    border-left: 1px solid transparent;
    transition: all 0.3s;
}

.rank-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-left-color: var(--accent-red);
    padding-left: 2rem;
}

.rank-item .icon {
    margin-right: 15px;
    font-size: 1rem;
    opacity: 0.7;
}

.rank-item .name {
    font-weight: 700;
    letter-spacing: 1px;
    margin-right: 10px;
    color: #ddd;
    font-size: 0.9rem;
}

.rank-item .rank-sub {
    font-size: 0.8rem;
    color: #666;
    margin-left: auto;
}

/* --- Laws --- */
.section-wood {
    background-color: #080808;
    border-top: 1px solid #111;
}

.laws-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.law {
    padding: 2rem;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s;
}

.law:hover {
    border-left-color: var(--accent-red);
    background: linear-gradient(90deg, rgba(139, 0, 0, 0.05), transparent);
}

.law h3 {
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.law p {
    color: #999;
    font-size: 0.95rem;
}

/* --- System Section --- */
.section-tech {
    background-color: #030303;
    border-top: 1px solid #111;
    font-family: var(--font-tech);
    padding-bottom: 5rem;
}

.tech-interface {
    border: 1px solid var(--glass-border);
    background: #0a0a0a;
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.tech-header {
    background: #0f0f0f;
    padding: 1.2rem 2rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #222;
}

.status-light {
    width: 8px;
    height: 8px;
    background: #333;
    border-radius: 50%;
    margin-right: 15px;
    transition: all 0.3s;
    cursor: pointer;
}

.status-light:hover {
    background: var(--tech-green);
    box-shadow: 0 0 10px var(--tech-green);
}

.tech-content {
    padding: 3rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.grid-item {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.5rem;
    border: 1px solid #1a1a1a;
}

.grid-item.full-width {
    grid-column: 1 / -1;
}

.grid-item label {
    display: block;
    color: #555;
    font-size: 0.7rem;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.value {
    font-size: 1.2rem;
    color: #ccc;
}

.value.number {
    color: var(--gold);
}

.bar-container {
    height: 2px;
    background: #222;
    margin-top: 10px;
}

.bar {
    height: 100%;
    background: var(--tech-green);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.2);
}

.tech-footer {
    padding: 1rem 2rem;
    background: #0f0f0f;
    border-top: 1px solid #222;
    text-align: right;
    font-size: 0.8rem;
    color: #444;
}

/* --- Dashboard Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.modal-content.large-modal {
    background-color: #0a0a0a;
    border: 1px solid #222;
    margin: 5% auto;
    padding: 0;
    width: 95%;
    max-width: 1000px;
    font-family: var(--font-tech);
    color: var(--tech-green);
    position: relative;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 20px;
    color: #555;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
}

.close-btn:hover {
    color: #fff;
}

.terminal-screen {
    padding: 3rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Allow scrolling if content overflows */
    height: 100%;
    /* Use available height */
    justify-content: flex-start;
    /* Default alignment top */
}

/* --- Login Screen & Keypad --- */
#loginScreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

#loginScreen h3 {
    margin-bottom: 2rem;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    letter-spacing: 3px;
    border-bottom: 1px solid var(--tech-green);
    padding-bottom: 10px;
}

#passcodeInput {
    background: rgba(0, 0, 0, 0.8) !important;
    border: 1px solid #333;
    border-bottom: 2px solid var(--tech-green);
    color: var(--tech-green);
    font-family: var(--font-tech);
    font-size: 2.5rem;
    text-align: center;
    width: 280px;
    margin-bottom: 2rem;
    letter-spacing: 15px;
    padding: 15px;
    transition: all 0.3s;
    outline: none;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

#passcodeInput:focus {
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.8);
    border-color: #fff;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 280px;
}

.key {
    background: rgba(0, 20, 0, 0.6);
    border: 1px solid var(--tech-green);
    color: var(--tech-green);
    padding: 20px 0;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-tech);
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 5px rgba(0, 255, 65, 0.1);
}

.key:hover {
    background: var(--tech-green);
    color: #000;
    box-shadow: 0 0 15px var(--tech-green);
    transform: scale(1.05);
}

.key:active {
    transform: scale(0.95);
}

.error-msg {
    color: var(--accent-red);
    margin-top: 1rem;
    height: 1.5rem;
    font-weight: bold;
    text-shadow: 0 0 10px var(--accent-red);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #30363d;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 1rem;
}

.user-info h3 {
    margin: 0;
    color: #fff;
    font-size: 1.2rem;
}

.role-badge {
    font-size: 0.8rem;
    color: var(--gold);
    border: 1px solid var(--gold);
    padding: 2px 8px;
    margin-top: 5px;
    display: inline-block;
}

.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 2rem;
    background: #111;
}

.tab-btn {
    background: #1a1a1a;
    border: none;
    color: #666;
    padding: 12px 25px;
    cursor: pointer;
    font-family: inherit;
    flex-grow: 1;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #222;
    color: #fff;
}

.tab-btn.active {
    background: var(--tech-green);
    color: #000;
    font-weight: bold;
}

/* Tables */
/* Tables with better contrast */
.tech-table {
    width: 100%;
    border-collapse: separate;
    /* Use separate to allow border-spacing */
    border-spacing: 0 5px;
    /* Add vertical spacing between rows */
}

.tech-table th {
    text-align: left;
    color: #888;
    padding: 15px;
    border-bottom: 2px solid var(--tech-green);
    /* Stronger separator */
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.8);
}

.tech-table td {
    padding: 15px;
    border: 1px solid #1a1a1a;
    background: rgba(255, 255, 255, 0.03);
    /* Subtle row background */
    color: #ccc;
}

/* Fix Inputs Visibility */
.actions-bar input,
.actions-bar select,
.announcement-form textarea,
.terminal-screen input {
    background: #000 !important;
    /* Force black background */
    border: 1px solid var(--tech-green);
    color: var(--tech-green);
    padding: 10px;
    font-family: var(--font-tech);
}

.badge {
    padding: 3px 10px;
    font-size: 0.7rem;
    letter-spacing: 1px;
}

.badge.kyodai {
    background: #1a237e;
    color: #8c9eff;
}

.badge.shatei {
    background: #33691e;
    color: #c5e1a5;
}

.badge.kobun {
    background: #3e2723;
    color: #bcaaa4;
}

.actions-bar {
    display: flex;
    gap: 10px;
    padding: 1rem;
    background: #111;
    margin-bottom: 1rem;
}

.actions-bar input,
.actions-bar select {
    background: #000;
    border: 1px solid #333;
    color: #fff;
    padding: 10px;
    font-family: inherit;
    flex-grow: 1;
}

.tech-btn {
    background: #222;
    border: 1px solid #333;
    color: #fff;
    padding: 10px 20px;
    cursor: pointer;
    font-family: inherit;
}

.tech-btn:hover {
    background: #333;
}

.announcement-item {
    background: #111;
    padding: 1.5rem;
    border-left: 2px solid var(--tech-green);
    margin-bottom: 1rem;
}

.ann-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: #555;
}

.ann-content {
    color: #eee;
}

/* Utilities */
.hidden {
    display: none !important;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 65, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 255, 65, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 65, 0);
    }
}

.shake {
    animation: shake 0.5s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Footer */
footer {
    padding: 4rem 10%;
    background: #050505;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.footer-content {
    opacity: 0.5;
    font-size: 0.8rem;
}

.footer-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #fff;
}

@media (max-width: 768px) {
    .main-title {
        font-size: 3.5rem;
    }

    .nav-links {
        display: none;
    }

    .tech-content {
        grid-template-columns: 1fr;
    }
}