:root {
    --bg: #e8e4dc;
    --surface: #f5f2ea;
    --paper-line: #c41e3a;
    --muted: #4a4a4a;
    --text: #1a1a1a;
    --accent: #c41e3a;
    --accent-2: #2a2a2a;
    --muted-2: #6a6a6a;
    --radius: 0px;
    --shadow-soft: 0 8px 24px rgba(196, 30, 58, 0.2);
    --max-width: 1200px;
    --focus: 2.5px solid #c41e3a;
    --paper-grain: none;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", "Noto Sans TC", system-ui, -apple-system, "Segoe UI", Roboto, Arial;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.7;
    font-size: 17px;
    scroll-padding-top: 132px;
    position: relative;
}

body {
    overflow-x: hidden;
    overflow-y: auto;
}

@media (max-width: 720px) {

    html,
    body {
        font-size: 16px;
        scroll-padding-top: 110px;
    }
}

#canvas-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: 1;
    background: transparent;
}

main#main {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.main-bg-wrap {
    position: relative;
    background: linear-gradient(135deg, rgba(245, 242, 234, 0.95) 0%, rgba(232, 228, 220, 0.95) 50%, rgba(216, 212, 204, 0.95) 100%);
    z-index: 1;
}



.main-bg-wrap::before {
    content: "";
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin-bottom: 32px;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(196, 30, 58, 0.02) 10px,
        rgba(196, 30, 58, 0.02) 20px
    );
    pointer-events: none;
}

.main-bg-content {
    position: relative;
    z-index: 2;
}

header.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    z-index: 100;
    background: rgba(245, 242, 234, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(196, 30, 58, 0.15);
    margin: 0;
    overflow: hidden; /* keep for header visuals; menu moved out so no clipping */
    box-shadow: 0 2px 20px rgba(196, 30, 58, 0.08),
                0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

/* Animated top border */
header.header::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(196, 30, 58, 0.6), 
        transparent);
    animation: borderSweep 3s infinite;
}

@keyframes borderSweep {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Tactical grid overlay */
header.header::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 4px, rgba(196, 30, 58, 0.02) 4px, rgba(196, 30, 58, 0.02) 5px),
        repeating-linear-gradient(90deg, transparent, transparent 4px, rgba(196, 30, 58, 0.02) 4px, rgba(196, 30, 58, 0.02) 5px);
    pointer-events: none;
    opacity: 0.5;
}

.header-spacer {
    width: 100%;
    display: block;
    background: transparent;
    height: 132px;
    position: relative;
    z-index: 1;
}

@media (max-width: 720px) {
    .header-spacer {
        height: 70px;
    }
}

.container {
    width: calc(100% - 40px);
    max-width: var(--max-width);
    margin: 0 auto;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    background: var(--accent);
    color: #fff;
    padding: 0.55rem 1rem;
    z-index: 9999;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
    border-radius: 0;
    box-shadow: 0 2px 6px rgba(196, 30, 58, 0.5);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 16px 24px;
    position: relative;
    z-index: 2;
}

/* Tactical corner markers */
.header-inner::before,
.header-inner::after {
    content: "";
    position: absolute;
    width: 30px;
    height: 30px;
    border: 2px solid rgba(196, 30, 58, 0.3);
    pointer-events: none;
}

.header-inner::before {
    top: 10px;
    left: 10px;
    border-right: none;
    border-bottom: none;
}

.header-inner::after {
    top: 10px;
    right: 10px;
    border-left: none;
    border-bottom: none;
}

.site-brand {
    display: flex;
    gap: 1rem;
    align-items: center;
    position: relative;
}



@keyframes targetPulse {
    0%, 100% { 
        box-shadow: 0 0 10px rgba(196, 30, 58, 0.5);
        transform: translateY(-50%) scale(1);
    }
    50% { 
        box-shadow: 0 0 20px rgba(196, 30, 58, 0.8);
        transform: translateY(-50%) scale(1.2);
    }
}


.brand-logo {
    width: 54px;
    height: 54px;
    border-radius: 0;
    padding: 4px;
    /* background: white; */
    /* box-shadow: 
        0 0 0 2px var(--accent),
        0 0 0 4px rgba(196, 30, 58, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.1),
        0 0 30px rgba(196, 30, 58, 0.2);
    flex: 0 0 54px;
    position: relative;
    animation: logoPulse 3s infinite;
    clip-path: polygon(
        10% 0%, 90% 0%, 100% 10%, 100% 90%, 
        90% 100%, 10% 100%, 0% 90%, 0% 10%
    ); */
}

@keyframes logoPulse {
    0%, 100% { 
        box-shadow: 
            0 0 0 2px var(--accent),
            0 0 0 4px rgba(196, 30, 58, 0.2),
            0 4px 12px rgba(0, 0, 0, 0.1),
            0 0 30px rgba(196, 30, 58, 0.2);
    }
    50% { 
        box-shadow: 
            0 0 0 2px var(--accent),
            0 0 0 4px rgba(196, 30, 58, 0.4),
            0 6px 16px rgba(0, 0, 0, 0.15),
            0 0 40px rgba(196, 30, 58, 0.4);
    }
}

/* Corner brackets for logo */
.brand-logo::before,
.brand-logo::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent);
    pointer-events: none;
}

.brand-logo::before {
    top: -6px;
    left: -6px;
    border-right: none;
    border-bottom: none;
}

.brand-logo::after {
    bottom: -6px;
    right: -6px;
    border-left: none;
    border-top: none;
}

.brand-name-chinese {
    font-weight: 900;
    font-size: 1.08rem;
    color: var(--accent);
    letter-spacing: 0.2em;
    line-height: 1;
    text-shadow: 
        0 0 10px rgba(196, 30, 58, 0.3),
        1px 1px 0 rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    position: relative;
}

/* Data stream effect */
.brand-name-chinese::before {
    /* content: "///"; */
    position: absolute;
    left: -25px;
    color: var(--accent);
    opacity: 0.5;
    font-size: 0.8em;
}

.brand-name-english {
    font-size: 0.89rem;
    color: var(--muted);
    margin-top: 2px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    opacity: 0.8;
    font-family: 'Courier New', monospace;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.control-group,
.font-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: var(--muted);
    font-size: 0.99rem;
    font-weight: 500;
    position: relative;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(196, 30, 58, 0.15);
    clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}

.control-group span,
.font-group span {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn {
    appearance: none;
    border: 2px solid rgba(196, 30, 58, 0.3);
    background: rgba(255, 255, 255, 0.8);
    padding: 0.36rem 0.8rem;
    border-radius: 0;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    transition: all .2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    letter-spacing: 0.1em;
    font-size: 1rem;
    outline: none;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
    font-family: 'Courier New', monospace;
    clip-path: polygon(3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%, 0 3px);
}

/* Scan line effect on buttons */
.btn::before {
    content: "";
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, transparent, rgba(196, 30, 58, 0.2), transparent);
    transition: top 0.4s;
}

.btn:hover::before {
    top: 100%;
}

.btn:hover,
.btn:focus {
    background: rgba(255, 255, 255, 1);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 
        0 0 15px rgba(196, 30, 58, 0.3),
        0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 
        0 0 20px rgba(196, 30, 58, 0.6), 
        0 4px 8px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset;
    font-weight: 900;
}

nav.nav {
    display: flex;
    justify-content: center;
    padding: 8px 0 14px;
    border-bottom: 1px solid rgba(196, 30, 58, 0.15);
    position: relative;
    z-index: 2;
    /* background: linear-gradient(180deg, rgba(245, 242, 234, 0.5) 0%, transparent 100%); */
}

/* Data visualization dots */
nav.nav::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 
        -100px 0 0 rgba(196, 30, 58, 0.3),
        -200px 0 0 rgba(196, 30, 58, 0.2),
        100px 0 0 rgba(196, 30, 58, 0.3),
        200px 0 0 rgba(196, 30, 58, 0.2);
}

.nav-links {
    display: flex;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    border: none;
    align-items: center;
    font-size: 1.07rem;
    font-weight: 600;
    backdrop-filter: none;
    position: relative;
    overflow: visible;
}

.nav-links:before {
    display: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    padding: 0.6rem 1.8rem;
    border-radius: 0;
    font-size: 1.03rem;
    letter-spacing: 0.15em;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
    outline: none;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    margin-right: 8px;
    clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    font-family: 'Courier New', monospace;
}

.nav-links li:first-child a {
    clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}

.nav-links li:last-child a {
    clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%);
    margin-right: 0;
}

/* Underline scan effect */
.nav-links a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s;
    box-shadow: 0 0 8px rgba(196, 30, 58, 0.6);
}

.nav-links a:hover::after,
.nav-links a:focus::after {
    width: 100%;
}

/* Corner markers on hover */
/* .nav-links a::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 8px;
    height: 8px;
    border-left: 2px solid var(--accent);
    border-top: 2px solid var(--accent);
    opacity: 0;
    transition: opacity 0.3s;
} */

.nav-links a:hover,
.nav-links a:focus {
    background: rgba(255, 255, 255, 1);
    color: var(--accent);
    box-shadow: 
        0 0 20px rgba(196, 30, 58, 0.2),
        0 4px 8px rgba(0, 0, 0, 0.1);
    font-weight: 900;
    border-color: rgba(196, 30, 58, 0.2);
}

.nav-links a:hover::before {
    opacity: 1;
}

.nav-links a.active,
.nav-links a[aria-current="page"] {
    background: var(--accent);
    color: #fff;
    box-shadow: 
        0 0 30px rgba(196, 30, 58, 0.5),
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    font-weight: 900;
    border-color: transparent;
}

.nav-links a.active::before {
    border-color: #fff;
    opacity: 1;
}

/* Mobile styles */
.mobile-toggle,
.mobile-menu,
.mobile-backdrop {
    display: none;
}

@media (max-width: 720px) {
    .header-inner {
        padding: 8px 12px;
        min-height: 56px;
    }

    .brand-logo {
        width: 40px;
        height: 40px;
        border-radius: 0;
        padding: 2px;
        flex: 0 0 40px;
    }

    .brand-name-chinese {
        font-size: 1rem;
    }

    .brand-name-english {
        font-size: 0.8rem;
    }

    .header-controls,
    nav.nav {
        display: none !important;
    }

    .mobile-toggle {
        display: inline-flex !important;
        justify-content: center;
        align-items: center;
        background: rgba(255, 255, 255, 0.8);
        border: 2px solid rgba(196, 30, 58, 0.3);
        padding: 6px;
        border-radius: 0;
        cursor: pointer;
        z-index: 120;
        color: var(--accent);
        clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
    }

    /* Menu and backdrop live at body level now; keep them on top */
    .mobile-menu {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 82vw;
        max-width: 320px;
        height: 100vh;
        background: rgba(245, 242, 234, 0.98);
        backdrop-filter: blur(20px);
        box-shadow: 6px 0 32px rgba(196, 30, 58, 0.3);
        z-index: 1000; /* very high to be above everything */
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        border-right: 3px solid var(--accent);
    }

    .mobile-menu.open {
        display: block;
        transform: translateX(0);
    }

    .mobile-menu-inner {
        padding: 30px 22px 22px 22px;
        display: flex;
        flex-direction: column;
        gap: 24px;
        min-height: 100vh;
        position: relative; /* no z-index here to avoid extra stacking context */
    }

    .mobile-close {
        position: absolute;
        top: 8px;
        right: 12px;
        background: none;
        border: none;
        font-size: 2rem;
        color: var(--accent);
        cursor: pointer;
        z-index: 1001; /* above everything in the menu panel */
        padding: 8px;
        line-height: 1;
    }

    .mobile-nav ul {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .mobile-nav a {
        color: var(--text);
        font-size: 1.1rem;
        font-weight: 800;
        padding: 11px 0;
        border-radius: 0;
        text-decoration: none;
        display: block;
        transition: all 0.2s;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        border-left: 3px solid transparent;
        padding-left: 15px;
        font-family: 'Courier New', monospace;
    }

    .mobile-nav a:hover,
    .mobile-nav a:focus {
        color: var(--accent);
        border-left-color: var(--accent);
        background: rgba(196, 30, 58, 0.05);
    }

    .mobile-controls {
        margin-top: 18px;
        display: flex;
        flex-direction: column;
        gap: 18px;
    }

    .mobile-controls .control-group,
    .mobile-controls .font-group {
        gap: 0.6rem;
        font-size: 1rem;
        justify-content: flex-start;
    }

    .mobile-backdrop {
        display: none;
        position: fixed;
        z-index: 900; /* just under the panel */
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        transition: opacity 0.3s;
        opacity: 0;
        pointer-events: none;
    }

    .mobile-backdrop.open {
        display: block;
        opacity: 1;
        pointer-events: all;
    }
}

.hero {
    padding: 60px 0 24px 0;
    text-align: center;
    background: transparent;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.hero::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        rgba(196, 30, 58, 0.03) 1px,
        transparent 2px,
        transparent 40px
    );
    animation: slide 20s linear infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes slide {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

@media (max-width: 720px) {
    .hero {
        padding: 24px 0 10px 0;
    }
}

.hero-banner-wrapper {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    background: transparent;
    z-index: 2;
}

.hero-banner {
    width: 100%;
    max-width: 1600px;
    min-width: 320px;
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(196, 30, 58, 0.3), 0 0 0 4px var(--accent), 0 0 0 8px #fff;
    border: none;
    display: block;
    margin: 0 auto 22px;
    background: #fff;
    position: relative;
    z-index: 1;
    object-fit: cover;
    aspect-ratio: 16/5;
    animation: borderPulse 3s infinite;
}

@keyframes borderPulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(196, 30, 58, 0.3), 0 0 0 4px var(--accent), 0 0 0 8px #fff; }
    50% { box-shadow: 0 12px 48px rgba(196, 30, 58, 0.5), 0 0 0 4px var(--accent), 0 0 0 8px #fff; }
}

#about303 h1#hero-title {
    font-family: 'Inter', 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 2.1rem;
    margin: 0.8rem 0 0.55rem;
    color: #1a1a1a;
    text-shadow: 2px 2px 0 rgba(196, 30, 58, 0.3);
    letter-spacing: 0.15em;
    text-align: center;
    text-transform: uppercase;
    position: relative;
    z-index: 2;
}

#about303 .hero-highlight {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 0.25rem 0.9rem;
    border-radius: 0;
    font-weight: 900;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
    margin: 0 8px;
    font-size: 1.09em;
    letter-spacing: 0.15em;
    clip-path: polygon(5% 0, 100% 0, 95% 100%, 0 100%);
    position: relative;
}

#about303 .hero-highlight::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    right: -2px;
    bottom: -2px;
    background: rgba(0, 0, 0, 0.1);
    clip-path: polygon(5% 0, 100% 0, 95% 100%, 0 100%);
    z-index: -1;
}

.box-p {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: justify;
  font-size: 1.08rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgba(196,30,58,0.13);
  border-left: 6px solid var(--accent);
  border-top: 2px solid #1a1a1a;
  margin-top: 0.7rem;
  margin-bottom: 0;
  padding: 1em 1.5em;
  position: relative;
  transition: box-shadow 0.2s;
}

p.box-p::before {
    content: "/// CLASSIFIED ///";
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--accent);
    color: #fff;
    padding: 2px 12px;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.1em;
}

@media (max-width: 720px) {
    #about303 h1#hero-title {
        font-size: 1.26rem;
    }

    p.box-p {
        font-size: 0.98rem;
    }
}

.features,
.info-section,
.elements-section {
    padding: 38px 0;
}

.section-heading {
    text-align: center;
    margin-bottom: 22px;
    position: relative;
}

.section-heading h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.7rem;
    color: #1a1a1a;
    margin: 0;
    font-weight: 900;
    letter-spacing: 0.15em;
    text-shadow: 2px 2px 0 rgba(196, 30, 58, 0.2);
    text-transform: uppercase;
    position: relative;
    display: inline-block;
}

.section-heading h2::before,
.section-heading h2::after {
    /* content: "///"; */
    color: var(--accent);
    margin: 0 15px;
    font-size: 0.8em;
}

.section-heading p {
    color: var(--muted);
    margin-top: 8px;
    font-size: 1.04rem;
}

.elements-panel {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 0;
    box-shadow: 8px 8px 0 rgba(196, 30, 58, 0.2);
    border: 3px solid #1a1a1a;
    border-top: 6px solid var(--accent);
    position: relative;
}

.elements-panel::before {
    content: "TOP SECRET";
    position: absolute;
    top: -18px;
    right: 30px;
    background: var(--accent);
    color: #fff;
    padding: 4px 20px;
    font-weight: 900;
    letter-spacing: 0.2em;
    font-size: 0.8rem;
}

.element-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
}

@media (max-width: 1100px) {
    .element-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 720px) {
    .element-grid {
        grid-template-columns: 1fr;
    }
}

.element-card {
    background: #f5f2ea;
    border-radius: 0;
    padding: 25px 18px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
    border: 2px solid #1a1a1a;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.element-card:hover {
    border-color: var(--accent);
    box-shadow: 6px 6px 0 rgba(196, 30, 58, 0.3);
    transform: translate(-2px, -2px);
}

.element-card:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent);
    opacity: 1;
}

.element-photo {
    width: 280px;
    height: 280px;
    border-radius: 0;
    object-fit: cover;
    margin-bottom: 18px;
    background: #fff;
    border: 3px solid #1a1a1a;
    box-shadow: 4px 4px 0 rgba(196, 30, 58, 0.2);
    transition: all 0.3s;
    filter: grayscale(0.2) contrast(1.1);
}

.element-card:hover .element-photo {
    filter: grayscale(0) contrast(1.2);
    box-shadow: 6px 6px 0 rgba(196, 30, 58, 0.4);
    transform: scale(1.02);
}

@media (max-width: 1100px) {
    .element-photo {
        width: 100%;
        max-width: 320px;
        height: auto;
        aspect-ratio: 1 / 1;
    }
}

@media (max-width: 720px) {
    .element-photo {
        width: 100%;
        max-width: 280px;
        height: auto;
        aspect-ratio: 1 / 1;
    }
}

.element-card h3 {
    margin: 0 0 13px;
    font-size: 1.13rem;
    color: #1a1a1a;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-shadow: 1px 1px 0 rgba(196, 30, 58, 0.2);
    text-transform: uppercase;
}

.desc-toggle {
    appearance: none;
    background: var(--accent);
    color: #fff;
    padding: 0.45rem 1.1rem;
    border-radius: 0;
    border: 2px solid #1a1a1a;
    font-weight: 900;
    cursor: pointer;
    margin-bottom: 10px;
    font-size: 1.01rem;
    letter-spacing: 0.1em;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2);
    outline: none;
    transition: all 0.2s;
    text-transform: uppercase;
    position: relative;
}

.desc-toggle:hover {
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
    transform: translate(-1px, -1px);
}

.desc-toggle:active {
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
    transform: translate(2px, 2px);
}

.desc-toggle[aria-expanded="true"] {
    background: #fff;
    color: var(--accent);
    border: 2px solid var(--accent);
}

.element-desc {
    display: none;
    width: 100%;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0;
}

.element-desc[aria-hidden="false"] {
    display: block;
    animation: slideDown 0.3s ease;
}

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

.feature-content {
    max-width: 900px;
    margin: 0 auto;
    color: var(--text);
}

.youtube-section {
    padding: 38px 0 0 0;
}


footer.footer {
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
    color: #b0b0b0;
    padding: 32px 0 24px;
    border-top: 4px solid var(--accent);
    font-size: 0.97rem;
    box-shadow: 0 -4px 0 rgba(196, 30, 58, 0.3);
    position: relative;
    z-index: 2;
}

.footer::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        var(--accent) 0px,
        var(--accent) 20px,
        transparent 20px,
        transparent 40px
    );
}

.footer p {
    margin: 6px 0;
    color: #b0b0b0;
}

.row {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.5);
    border-radius: 0;
}

.font-small {
    font-size: 0.92rem;
}

.font-medium {
    font-size: 1.01rem;
}

.font-large {
    font-size: 1.14rem;
}
#header-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.6;
}

/* Smooth transitions for hover */
.brand-logo {
  transition: transform 200ms ease, filter 200ms ease, box-shadow 200ms ease;
}



/* 1) Make focus ring keyboard-only across the site */
:focus {
  outline: none;
  box-shadow: none; /* replace the old global :focus box-shadow */
}
:focus-visible {
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.5);
  border-radius: 0;
  outline: none;
}

/* 2) Do not show any ring on the brand link when clicked with a mouse */
.site-brand a:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* Also ensure the image inside doesn't show any outline on mouse click */
.site-brand a:focus:not(:focus-visible) .brand-logo,
.brand-logo:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* 3) Optional: keep a clear keyboard outline on the logo only
   (comment this out if you want NO border even for keyboard navigation) */
.site-brand a:focus-visible .brand-logo {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

/* Base */
html { font-size: 17px; }

/* Mobile base (keep your existing media query if needed) */
@media (max-width: 720px) {
  html { font-size: 16px; }
}

/* Class-driven sizes (these override the base) */
html.font-small  { font-size: 15px; }
html.font-medium { font-size: 17px; }
html.font-large  { font-size: 19px; }


/* Ensure all .element-desc and .box-p align height visually */
.element-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}

.element-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  /* Ensure cards are the same height */
  min-height: 620px; /* adjust as needed to fit your content & layout */
}

.element-desc {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
}

.box-p {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 160px; /* adjust this value so all boxes match your design */
  font-size: 1.08rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgba(196,30,58,0.13);
  border-left: 6px solid var(--accent);
  border-top: 2px solid #1a1a1a;
  margin-top: 0.7rem;
  margin-bottom: 0;
  padding: 1em 1.5em;
  position: relative;
  transition: box-shadow 0.2s;
}

@media (max-width: 720px) {
  .element-grid {
    grid-template-columns: 1fr;
  }
  .element-card {
    min-height: unset;
  }
  .box-p {
    min-height: 120px;
  }
}

/* Adjust height alignment for all .box-p boxes */
.element-desc {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: flex-end;
}



@media (min-width: 860px) {
  .box-p {
    flex: 1 1 0;
    min-height: 180px;
    
  }
}

.element-desc {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  min-height: 0;                /* Allows flex to shrink properly */
}


.signup-method .step-block {
  max-width: 900px;
  margin: 30px auto 0;
  padding: 2em 2.5em;
  background: #fff;
  border-left: 6px solid var(--accent);
  border-top: 2px solid #1a1a1a;
  box-shadow: 4px 4px 0 rgba(196, 30, 58, 0.15);
  border-radius: 8px;
  font-family: "Noto Sans TC", sans-serif;
  color: var(--text);
}

.signup-method .step {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid #e4d8d8;
  padding: 1.2em 0;
  align-items: flex-start;
}

.signup-method .step:last-child {
  border-bottom: none;
}

.step-num {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: #fff;
  font-family: "Courier New", monospace;
  font-weight: 900;
  font-size: 1.3rem;
  border-radius: 50%;
  text-align: center;
  line-height: 40px;
  box-shadow: 0 2px 8px rgba(196, 30, 58, 0.3);
  user-select: none;
}

.signup-method .step p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.7;
}

@media (max-width: 720px) {
  .signup-method .step-block {
    padding: 1.4em 1.5em;
    max-width: 100%;
  }
  .step-num {
    width: 30px;
    height: 30px;
    font-size: 1rem;
    line-height: 30px;
  }
  .signup-method .step p {
    font-size: 0.95rem;
  }
  .signup-method .step {
    gap: 15px;
  }
}
.op303-logo img {
  height: 50px;
  max-width: 180px;
  width: auto;
  display: block;
  object-fit: contain;
}

@media (max-width: 720px) {
    #about303 h1.hero-title {
        font-size: 1.26rem;
    }

    p.box-p {
        font-size: 0.95rem;        /* Reduced from 0.98rem */
        padding: 0.8em 1em;         /* Reduced from 1em 1.5em */
    }
}
@media (max-width: 720px) {
    .element-grid {
        grid-template-columns: 1fr;
    }

    .element-card {
        min-height: unset;
    }

    .box-p {
        min-height: 100px;         /* Reduced from 120px */
        padding: 0.8em 1em;         /* Reduced from default 1em 1.5em */
        font-size: 0.95rem;         /* Reduced from 1.08rem */
    }
}

.element-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  /* Cards auto-adjust height based on content */
}

@media (max-width: 720px) {
    .header-inner::before,
    .header-inner::after {
        display: none;
    }
}

.youtube-video-wrapper {
    width: 100%;
    max-width: 1200px;      /* Desktop: limit max width */
    min-width: 1200px;           /* Prevent overflow on mobile */
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 0;
    box-shadow: 8px 8px 0 rgba(196, 30, 58, 0.3);
    overflow: hidden;
    border: 4px solid #1a1a1a;
    position: relative;
}

.youtube-video-wrapper iframe {
    width: 100%;
    height: 100%;
    min-height: 360px;      /* Reasonable height for most screens */
    border: none;
    display: block;
    background: #000;
}

@media (max-width: 1220px) {
    .youtube-video-wrapper {
    min-width: 0px;  
    }

}


/* Responsive for mobile */
@media (max-width: 900px) {
    .youtube-video-wrapper {
        max-width: 100vw;           /* Use full viewport width */
        min-width: 0;
        border-radius: 0;
    }

    .youtube-video-wrapper iframe {
        min-height: 180px;          /* Smaller minimum height for mobile */
    }
}
@media (max-width: 720px) {
    .youtube-video-wrapper {
        aspect-ratio: 16 / 9;
        max-width: 100vw;
        min-width: 0;
        border-radius: 0;
    }
    .youtube-video-wrapper iframe {
        min-height: 140px;
    }
}

.carousel {
  position: relative;
  max-width: 1600px;
  margin: 0 auto;
  overflow: hidden;
  aspect-ratio: 16/5;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease;
}

.carousel-slide {
  min-width: 100%;
  object-fit: cover;
  border: none;
  border-radius: 0;
}

.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(196,30,58,0.7);
  color: #fff;
  border: none;
  font-size: 2rem;
  padding: 0.5em 1em;
  cursor: pointer;
  z-index: 2;
  border-radius: 50%;
  opacity: 0.8;
  transition: background 0.2s;
}
.carousel-control.prev { left: 15px; }
.carousel-control.next { right: 15px; }
.carousel-control:hover, .carousel-control:focus { background: var(--accent); opacity: 1; }

.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, rgba(196,30,58,0.85) 0%, rgba(245,242,234,0.6) 100%);
  color: #fff;
  border: none;
  font-size: 2rem;
  padding: 0.5em 1em;
  cursor: pointer;
  z-index: 2;
  border-radius: 50%;
  opacity: 0.85;
  box-shadow: 0 4px 18px rgba(196,30,58,0.28), 0 0 0 3px rgba(196,30,58,0.18) inset;
  transition: 
    background 0.25s,
    box-shadow 0.25s,
    transform 0.18s,
    opacity 0.2s;
  outline: none;
}

.carousel-control:hover,
.carousel-control:focus {
  background: linear-gradient(135deg, #c41e3a 0%, #fff0f3 100%);
  opacity: 1;
  box-shadow: 0 0 24px 6px rgba(196,30,58,0.45), 0 0 0 5px #c41e3a55 inset;
  transform: translateY(-50%) scale(1.08);
}

.carousel-control:active {
  box-shadow: 0 2px 8px rgba(196,30,58,0.28);
  transform: translateY(-50%) scale(0.96);
}

.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, rgba(196,30,58,0.85) 0%, rgba(245,242,234,0.65) 100%);
  color: #fff;
  border: none;
  font-size: 1.2rem; /* Smaller icon/text size */
  padding: 0.3em 0.7em; /* Smaller button size */
  cursor: pointer;
  z-index: 2;
  border-radius: 50%;
  opacity: 0.9;
  box-shadow: 0 2px 10px rgba(196,30,58,0.15), 0 0 0 2px rgba(196,30,58,0.13) inset;
  transition: 
    background 0.22s,
    box-shadow 0.18s,
    transform 0.15s,
    opacity 0.18s;
  outline: none;
}

.carousel-control:hover,
.carousel-control:focus {
  background: linear-gradient(135deg, #c41e3a 0%, #fff0f3 100%);
  opacity: 1;
  box-shadow: 0 0 12px 2px rgba(196,30,58,0.28), 0 0 0 3px #c41e3a33 inset;
  transform: translateY(-50%) scale(1.07);
}

.carousel-control:active {
  box-shadow: 0 1px 5px rgba(196,30,58,0.20);
  transform: translateY(-50%) scale(0.96);
}

.carousel-control.prev { left: 10px; }
.carousel-control.next { right: 10px; }


.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, rgba(196,30,58,0.85) 0%, rgba(245,242,234,0.65) 100%);
  color: #fff;
  border: none;
  font-size: 1.2rem;           /* Smaller icon/text size */
  padding: 0.25em 0.55em;      /* Compact size */
  cursor: pointer;
  z-index: 2;
  border-radius: 50%;
  opacity: 0.92;
  box-shadow: 0 2px 10px rgba(196,30,58,0.14), 0 0 0 2px rgba(196,30,58,0.12) inset;
  transition: 
    background 0.22s,
    box-shadow 0.18s,
    transform 0.15s,
    opacity 0.18s;
  outline: none;
}

.carousel-control.prev { left: 10px; }
.carousel-control.next { right: 10px; }

.carousel-control:hover,
.carousel-control:focus {
  background: linear-gradient(135deg, #c41e3a 0%, #fff0f3 100%);
  opacity: 1;
  box-shadow: 0 0 12px 2px rgba(196,30,58,0.28), 0 0 0 3px #c41e3a33 inset;
  transform: translateY(-50%) scale(1.07);
}

.carousel-control:active {
  box-shadow: 0 1px 5px rgba(196,30,58,0.20);
  transform: translateY(-50%) scale(0.96);
}

@media (max-width: 720px) {
  .carousel-control {
    font-size: 0.95rem;          /* Smaller text/icon */
    padding: 0.18em 0.35em;      /* More compact */
    /* Remove left/right here! */
  }
  .carousel-control.prev { left: 4px !important; right: auto !important; }
  .carousel-control.next { right: 4px !important; left: auto !important; }
}

.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    align-items: center;     /* new - ensures vertical centering */
    justify-content: center; /* new - ensures horizontal centering */
}

@media (max-width: 768px) {
    .modal {
        display: flex;          /* Use flex only on mobile for centering */
        flex-direction: column; /* Ensure vertical stacking if needed */
        align-items: center;    /* Center horizontally */
        justify-content: center;/* Center vertically */
        width: 100vw;
        height: 100vh;
        padding: 0;             /* No scroll padding by default */
        box-sizing: border-box;
    }
    .modal-content {
        margin: 0;              /* Remove margin for perfect centering */
        width: 90vw;            /* Slightly wider on small screens */
        max-width: 95vw;        /* Prevent overflow */
    }
}

        .modal-content {
            background-color: #fefefe;
            margin: 15% auto;
            padding: 20px;
            border: 1px solid #888;
            width: 80%;
            max-width: 500px;
            text-align: center;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.2);
        }
        .modal-content h2 {
            margin-top: 0;
            color: #c41e3a;
            font-weight: bold;
        }
        #close-modal {
            background: #c41e3a;
            color: white;
            border: none;
            padding: 10px 20px;
            cursor: pointer;
            border-radius: 4px;
            font-weight: bold;
            margin-top: 10px;
        }
        #close-modal:hover {
            background: #a01830;
        }
        