/* OMAKASE THEME VARIABLES (Default: Sushi) */
:root, [data-theme="sushi"] {
    --bg-color: #151412; /* Deep charcoal / Nori */
    --text-main: #dcd8cf; /* Warm rice white */
    --text-muted: #8c867a; /* Muted stone */
    --accent-matcha: #889c68; /* Matcha green */
    --accent-maguro: #bf4b32; /* Tuna red / Vermilion */
    --accent-bamboo: #c0a062; /* Bamboo gold */
    --border-subtle: rgba(220, 216, 207, 0.1);
    --hanko-char: '匠';
    --card-bg: rgba(255, 255, 255, 0.03);
    --font-heading: 'Shippori Mincho', serif;
    --font-body: 'Inter', sans-serif;
    --quote-bg: rgba(192, 160, 98, 0.08);
    --table-header-bg: rgba(192, 160, 98, 0.1);
}

/* GHIBLI THEME: Lush, Hand-painted, Whimsical, Soft */
[data-theme="ghibli"] {
    --bg-color: #f4ece1; /* Warm cream paper */
    --text-main: #4a3c28; /* Earthy brown */
    --text-muted: #8d7a5e; 
    --accent-matcha: #7ca561; /* Moss green */
    --accent-maguro: #d65d4a; /* Soft persimmon */
    --accent-bamboo: #e0a53b; /* Golden hay */
    --border-subtle: rgba(74, 60, 40, 0.1);
    --hanko-char: '森';
    --card-bg: #fffcf5;
    --font-heading: 'Shippori Mincho', serif;
    --font-body: 'Shippori Mincho', serif;
    --quote-bg: rgba(224, 165, 59, 0.1);
    --table-header-bg: rgba(124, 165, 97, 0.15);
}

/* RAMEN THEME: Naruto Inspired - Warm, Vibrant, Savory */
[data-theme="ramen"] {
    --bg-color: #fff9e6; /* Soft Eggshell */
    --text-main: #3e2723; /* Deep Ramen Broth Brown */
    --text-muted: #8d6e63; 
    --accent-matcha: #4caf50; /* Fresh Scallion */
    --accent-maguro: #ff5722; /* Naruto Orange */
    --accent-bamboo: #fbc02d; /* Egg Yolk Yellow */
    --border-subtle: rgba(255, 87, 34, 0.2);
    --hanko-char: '🍥';
    --card-bg: #ffffff;
    --font-heading: 'Shippori Mincho', serif;
    --font-body: 'Inter', sans-serif;
    --quote-bg: rgba(255, 87, 34, 0.05);
    --table-header-bg: rgba(251, 192, 45, 0.2);
}

/* NGE THEME: Neon Genesis Evangelion Inspired - Emergency/Crisis */
[data-theme="nge"] {
    --bg-color: #0b0216; /* Deepest Void Purple */
    --text-main: #ff8c00; /* Emergency Orange */
    --text-muted: #6f42c1; /* Unit-01 Purple */
    --accent-matcha: #39ff14; /* Neon Green Highlights */
    --accent-maguro: #ff3300; /* Crisis Red */
    --accent-bamboo: #ffff00; /* LCL Yellow */
    --border-subtle: rgba(255, 140, 0, 0.3);
    --hanko-char: '使';
    --card-bg: rgba(20, 5, 35, 0.95);
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --quote-bg: rgba(255, 51, 0, 0.1);
    --table-header-bg: rgba(255, 140, 0, 0.2);
}

body {
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.8;
    font-size: 1rem;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.8s ease, color 0.8s ease;
    background-repeat: no-repeat;
    background-size: cover;
}

/* GHIBLI BACKGROUND: Watercolor effect */
[data-theme="ghibli"] body {
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(124, 165, 97, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(214, 93, 74, 0.05) 0%, transparent 40%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    background-blend-mode: overlay;
}

/* RAMEN BACKGROUND: Naruto Swirl Pattern */
[data-theme="ramen"] body {
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(251, 192, 45, 0.05) 0%, transparent 70%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0c16.569 0 30 13.431 30 30S46.569 60 30 60 0 46.569 0 30 13.431 0 30 0zm0 10C18.954 10 10 18.954 10 30s8.954 20 20 20 20-8.954 20-20-8.954-20-20-20zm0 5c8.284 0 15 6.716 15 15s-6.716 15-15 15-15-6.716-15-15 6.716-15 15-15zm0 5c5.523 0 10 4.477 10 10s-4.477 10-10 10-10-4.477-10-10 4.477-10 10-10z' fill='%23ff5722' fill-opacity='0.03'/%3E%3C/svg%3E");
}

/* NGE BACKGROUND: Hexagonal Grid / Hazard Stripes */
[data-theme="nge"] body {
    background-image: 
        linear-gradient(45deg, rgba(255, 140, 0, 0.05) 25%, transparent 25%, transparent 50%, rgba(255, 140, 0, 0.05) 50%, rgba(255, 140, 0, 0.05) 75%, transparent 75%, transparent);
    background-size: 100px 100px;
    background-color: var(--bg-color);
}

/* Traditional Seigaiha (Wave) Top Border */
.seigaiha-border {
    position: fixed;
    top: 0; left: 0; right: 0; height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='20' viewBox='0 0 40 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 20c-5.523 0-10-4.477-10-10S14.477 0 20 0s10 4.477 10 10-4.477 10-10 10zm0-2c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zm0-2c3.314 0 6-2.686 6-6s-2.686-6-6-6-6 2.686-6 6 2.686 6 6 6zm0-2c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0-2c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23bf4b32' fill-opacity='0.2'/%3E%3C/svg%3E");
    z-index: 1000;
}

[data-theme="ramen"] .seigaiha-border, [data-theme="nge"] .seigaiha-border { display: none; }

/* Vertical Watermark (Tategaki) */
.tategaki-watermark {
    position: fixed; left: 3vw; top: 20vh;
    writing-mode: vertical-rl; text-orientation: upright;
    font-family: 'Shippori Mincho', serif;
    color: var(--text-muted); font-size: 1.1rem;
    letter-spacing: 0.6em; opacity: 0.15;
    pointer-events: none; z-index: 0;
}

/* Japanese Hanko Stamp (Inkan) */
.hanko-stamp {
    position: fixed; top: 10vh; right: 8vw;
    width: 75px; height: 75px;
    border: 4px solid var(--accent-maguro); border-radius: 12px;
    color: var(--accent-maguro); font-family: 'Shippori Mincho', serif;
    font-size: 2.8rem; display: flex; align-items: center; justify-content: center;
    opacity: 0.7; transform: rotate(-10deg);
    pointer-events: none; z-index: 50;
    box-shadow: inset 0 0 4px var(--accent-maguro), 0 0 4px var(--accent-maguro);
    background-color: transparent;
    transition: all 0.8s ease;
}

[data-theme="ramen"] .hanko-stamp {
    border: 4px solid var(--accent-maguro);
    color: var(--accent-maguro);
    border-radius: 50%;
    transform: rotate(5deg);
    box-shadow: inset 0 0 6px var(--accent-maguro);
}

[data-theme="nge"] .hanko-stamp {
    border: 3px double var(--text-main);
    color: var(--text-main);
    box-shadow: 0 0 20px rgba(255, 140, 0, 0.4);
    border-radius: 4px;
    transform: rotate(0deg);
}

.hanko-stamp::after { content: var(--hanko-char); margin-top: 5px; }

/* Elaborate Sushi Loader */
#sushi-loader {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.loader-backdrop {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg-color); z-index: -1;
}
.sushi-container {
    position: relative; z-index: 2; text-align: center;
}
.sushi {
    font-size: 6rem; display: inline-block; animation: sushiToss 1.2s infinite cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.chopsticks {
    font-size: 4rem; position: absolute; top: 0; right: -30px; animation: chopstickPinch 1.2s infinite ease-in-out; transform-origin: bottom left;
}
.loader-text {
    margin-top: 1.5rem; font-family: 'Shippori Mincho', serif; color: var(--accent-bamboo); font-size: 1.2rem; letter-spacing: 2px; animation: pulseText 1.5s infinite;
}
.loader-text small {
    font-family: 'Inter', sans-serif; font-size: 0.7rem; letter-spacing: 4px; text-transform: uppercase; color: var(--text-muted); display: block; margin-top: 5px;
}

#sushi-loader.active-loader { opacity: 1; pointer-events: all; }
body.is-loading #slide-container article {
    opacity: 0 !important; transform: scale(0.9) translateY(-30px) !important; filter: blur(10px) !important; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

@keyframes sushiToss {
    0% { transform: translateY(0) rotate(0deg) scale(1); }
    50% { transform: translateY(-40px) rotate(15deg) scale(1.1); filter: drop-shadow(0 20px 10px rgba(0,0,0,0.3)); }
    100% { transform: translateY(0) rotate(0deg) scale(1); }
}
@keyframes chopstickPinch {
    0%, 100% { transform: rotate(15deg) translateX(10px); }
    50% { transform: rotate(0deg) translateX(-10px); }
}
@keyframes pulseText {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* HTMX Transitions */
#slide-container.htmx-swapping article {
    opacity: 0; transform: scale(0.95) translateY(-20px); filter: blur(5px); transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.fade-in { animation: fadeIn 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; opacity: 0; }
@keyframes fadeIn { 
    0% { opacity: 0; transform: translateY(30px) scale(0.98); filter: blur(8px); } 
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); } 
}
.slide-left { animation: slideLeft 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; opacity: 0; transform-origin: center right; }
@keyframes slideLeft { 
    0% { transform: translateX(100px) scale(0.95) rotateY(15deg); opacity: 0; filter: blur(6px); } 
    100% { transform: translateX(0) scale(1) rotateY(0deg); opacity: 1; filter: blur(0); } 
}
.zoom-in { animation: zoomIn 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; opacity: 0; }
@keyframes zoomIn { 
    0% { transform: scale(0.8) translateY(40px); opacity: 0; filter: blur(10px); } 
    100% { transform: scale(1) translateY(0); opacity: 1; filter: blur(0); } 
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading); font-weight: 500; color: var(--text-main); margin-top: 0; position: relative;
}
h2 {
    font-size: 1.8rem; margin-bottom: 2rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 1rem; letter-spacing: 0.5px;
}
h2::before {
    content: ''; display: inline-block; width: 8px; height: 8px; background-color: var(--accent-maguro); margin-right: 12px; transform: translateY(-3px) rotate(45deg);
}
h3 { font-size: 1.25rem; margin-top: 2.5rem; color: var(--accent-bamboo); }
strong { font-weight: 600; color: var(--text-main); }
em { font-style: italic; color: var(--text-muted); }

/* Slide Container Setup */
#slide-container { height: 100vh; width: 100vw; overflow-y: auto; scroll-behavior: smooth; }
#slide-container::-webkit-scrollbar { width: 0px; background: transparent; }

article { padding: 12vh 18vw 20vh 15vw; min-height: 100vh; box-sizing: border-box; position: relative; z-index: 10; }

/* SUSHI ARTICLE */
[data-theme="sushi"] article { border-left: 2px solid var(--accent-maguro); }

/* GHIBLI ARTICLE: Paper card */
[data-theme="ghibli"] article {
    background: var(--card-bg); margin: 4vh 4vw; min-height: 92vh; border-radius: 60px 30px 80px 40px; box-shadow: 0 40px 100px rgba(74, 60, 40, 0.08); border: 1px solid rgba(124, 165, 97, 0.1);
}

/* RAMEN ARTICLE: Naruto Shop Card */
[data-theme="ramen"] article {
    background: var(--card-bg); border: 4px solid var(--accent-maguro); border-radius: 20px; box-shadow: 0 15px 40px rgba(62, 39, 35, 0.1); margin: 4vh 4vw; min-height: 92vh;
}

/* NGE ARTICLE: Tactical Frame */
[data-theme="nge"] article {
    border: 4px solid var(--text-main); background: var(--card-bg); margin: 2vh 2vw; min-height: 96vh; border-radius: 0; clip-path: polygon(0 0, 95% 0, 100% 5%, 100% 100%, 5% 100%, 0 95%); box-shadow: 20px 20px 0px rgba(111, 66, 193, 0.3);
}

/* GHIBLI TITLES */
[data-theme="ghibli"] h1.slide-title { color: var(--text-main); font-size: 3rem; }
[data-theme="ghibli"] h2 { color: var(--accent-matcha); border-bottom: 2px dashed var(--accent-bamboo); }

/* RAMEN TITLES */
[data-theme="ramen"] h1.slide-title { color: var(--accent-maguro); letter-spacing: 2px; }
[data-theme="ramen"] h2 { color: var(--text-main); border-bottom: 3px solid var(--accent-bamboo); }

/* NGE TITLES */
[data-theme="nge"] h1.slide-title { font-weight: 900; text-transform: uppercase; letter-spacing: -2px; font-style: italic; background: linear-gradient(to bottom, #ff8c00, #ff3300); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
[data-theme="nge"] h2 { color: var(--accent-bamboo); border-bottom: 4px solid var(--text-main); padding-left: 20px; border-left: 10px solid var(--text-main); }

.slide-content-body { max-width: 900px; margin: 0 auto; }

/* Lists */
ul { padding-left: 1.5rem; }
li { margin-bottom: 0.8rem; position: relative; list-style-type: none; }
li::before { content: ''; position: absolute; left: -1.5rem; top: 0.65rem; width: 4px; height: 4px; background-color: var(--accent-maguro); border-radius: 50%; }

/* Blockquotes */
blockquote {
    position: relative; padding: 1.5rem 2.5rem; margin: 2.5rem 0;
    font-family: 'Shippori Mincho', serif; font-style: italic;
    font-size: 1.4rem; color: var(--accent-bamboo);
    background: var(--quote-bg);
    border-left: 4px solid var(--accent-maguro);
    border-radius: 0 8px 8px 0;
}
blockquote::before {
    content: '「'; position: absolute; left: 0.5rem; top: 0.5rem;
    font-size: 2.5rem; color: var(--accent-maguro); opacity: 0.6; font-style: normal;
}
blockquote::after {
    content: '」'; position: absolute; right: 1rem; bottom: -0.5rem;
    font-size: 2.5rem; color: var(--accent-maguro); opacity: 0.6; font-style: normal;
}

/* Tables */
table {
    width: 100%; border-collapse: collapse; margin: 2.5rem 0;
    font-size: 1rem; position: relative;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
}
table::after {
    content: '承認'; position: absolute; bottom: -25px; right: 10px;
    color: var(--accent-maguro); font-family: 'Shippori Mincho', serif;
    font-size: 0.7rem; border: 1px solid var(--accent-maguro); border-radius: 50%;
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    opacity: 0.3; transform: rotate(15deg); pointer-events: none;
}
th, td { padding: 1.2rem; text-align: left; border-bottom: 1px solid var(--border-subtle); }
th {
    background: var(--table-header-bg);
    color: var(--accent-bamboo); font-family: 'Shippori Mincho', serif;
    font-weight: 700; text-transform: uppercase; letter-spacing: 2px; font-size: 0.85rem;
}

[data-theme="ramen"] th, [data-theme="ghibli"] th {
    color: var(--text-main);
}

tr:hover {
    background: rgba(255, 255, 255, 0.05);
}
hr { border: none; height: 1px; background: var(--border-subtle); margin: 3rem 0; }

/* Menu List */
.menu-list { list-style: none; padding: 0; margin-top: 2rem; max-width: 600px; }
.menu-list li { 
    margin-bottom: 2rem; border-bottom: 1px dotted var(--border-subtle); 
    padding-bottom: 1rem; display: flex; justify-content: space-between; align-items: baseline;
}
.menu-list li::before { display: none; }
.menu-list a { 
    font-family: 'Shippori Mincho', serif; font-size: 1.4rem; 
    text-decoration: none; color: var(--text-main); transition: color 0.3s;
}
.menu-list a:hover { color: var(--accent-maguro); }
.menu-list small { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 2px; }

/* Glassmorphism Bottom Bar */
.omakase-glass-bar {
    position: fixed; bottom: 3vh; left: 50%; transform: translateX(-50%); width: 85%; max-width: 1100px; height: 60px; border-radius: 8px; background: var(--bg-color); opacity: 0.95; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--border-subtle); display: grid; grid-template-columns: 250px 1fr 100px; align-items: center; padding: 0 2rem; z-index: 1000; box-shadow: 0 10px 40px rgba(0,0,0,0.5); transition: all 0.5s ease;
}

[data-theme="ramen"] .omakase-glass-bar { background: rgba(255, 249, 230, 0.95); border: 2px solid var(--accent-maguro); border-radius: 10px; }
[data-theme="ghibli"] .omakase-glass-bar { border-radius: 30px 10px 30px 10px; background: rgba(255, 252, 245, 0.9); }
[data-theme="nge"] .omakase-glass-bar { background: #000; border: 2px solid var(--text-main); border-radius: 0; }

.omakase-badge { background: var(--accent-maguro); color: #fff; font-size: 0.65rem; font-weight: 600; padding: 3px 8px; border-radius: 2px; vertical-align: middle; margin-right: 12px; letter-spacing: 2px; }
.bar-left { font-family: 'Shippori Mincho', serif; font-size: 1rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-right { display: flex; gap: 20px; align-items: center; justify-content: flex-end; }
#omakase-nav { display: flex; gap: 1rem; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
#omakase-nav::-webkit-scrollbar { display: none; }
#omakase-nav a { color: var(--text-muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; text-decoration: none; transition: all 0.3s ease; cursor: pointer; }
#omakase-nav a:hover { color: var(--accent-bamboo); }
.zen-btn { background: transparent; border: 1px solid var(--border-subtle); color: var(--text-muted); border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s ease; font-size: 1rem; padding: 0; }
.zen-btn.active { border-color: var(--accent-maguro); color: var(--accent-maguro); box-shadow: 0 0 10px rgba(191, 75, 50, 0.3); animation: lanternPulse 2s infinite ease-in-out; }

/* Remote Control Status */
.remote-status { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-maguro); margin-left: 8px; vertical-align: middle; box-shadow: 0 0 5px var(--accent-maguro); }
.remote-status.connected { background: var(--accent-matcha); box-shadow: 0 0 5px var(--accent-matcha); }

/* Sensu Virtual Pointer */
#virtual-pointer { position: fixed; width: 44px; height: 44px; border: 3px solid var(--accent-maguro); border-radius: 50%; background: var(--accent-maguro); opacity: 0.15; color: var(--accent-maguro); display: flex; align-items: center; justify-content: center; font-family: 'Shippori Mincho', serif; font-size: 1.4rem; font-weight: bold; pointer-events: none; z-index: 10000; transition: transform 0.05s linear, border-color 0.8s; display: none; top: 0; left: 0; box-shadow: 0 0 15px var(--accent-maguro); }
#virtual-pointer::after { content: '印'; }

/* SITEMAP COURSES */
.sitemap-course { background: var(--card-bg); padding: 2rem; border-radius: 12px; border: 1px solid var(--border-subtle); transition: all 0.3s ease; cursor: pointer; }
[data-theme="ramen"] .sitemap-course { box-shadow: 0 5px 15px rgba(62, 39, 35, 0.05); }
[data-theme="nge"] .sitemap-course { border-radius: 0; border: 2px solid var(--text-main); box-shadow: 5px 5px 0px var(--text-muted); }
.sitemap-course:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.2); border-color: var(--accent-matcha); }
[data-theme="ramen"] .sitemap-course:hover { border-color: var(--accent-maguro); box-shadow: 0 10px 30px rgba(255, 87, 34, 0.1); }
[data-theme="nge"] .sitemap-course:hover { box-shadow: 10px 10px 0px var(--accent-matcha); background: rgba(111, 66, 193, 0.1); }

a, button, [onclick], .zen-btn, #omakase-nav a, .home-link { cursor: pointer !important; }
hgroup h2 { display: none; }

/* Floating Emojis (Audience Reactions) */
.floating-emoji {
    position: fixed;
    bottom: -60px;
    font-size: 3.5rem;
    pointer-events: none;
    z-index: 10000;
    animation: floatUp 3.5s linear forwards;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
    user-select: none;
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    10% { opacity: 1; transform: translateY(-50px) scale(1.2); }
    80% { opacity: 0.8; transform: translateY(-80vh) scale(1); }
    100% { transform: translateY(-100vh) scale(0.8); opacity: 0; }
}
