@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;700;900&family=Yomogi&family=Sawarabi+Gothic&family=M+PLUS+Rounded+1c:wght@400;700;900&display=swap');

:root {
    --bg-dark: #0f172a;
    --primary-gold: #fbbf24;
    --accent-blue: #38bdf8;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.05);
    --shadow-premium: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    
    /* Paper colors for quotes - refined for dark mode */
    --paper-blue: rgba(56, 189, 248, 0.1);
    --paper-red: rgba(248, 113, 113, 0.1);
    --paper-green: rgba(52, 211, 153, 0.1);
    --paper-yellow: rgba(251, 191, 36, 0.1);
}

/* Global Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(251, 191, 36, 0.1) 0px, transparent 50%),
        url('https://www.transparenttextures.com/patterns/dark-matter.png');
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Premium Header with Advanced Glassmorphism */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

header h1 {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.05em;
}

header .subtitle {
    display: none; /* Hidden on mobile/small headers */
}

/* Hero Section - Immersive Design */
.hero-section {
    padding: 8rem 1rem 6rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-title {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 900;
    margin-bottom: 2rem;
    line-height: 1.1;
    background: linear-gradient(to bottom, #fff 20%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: heroReveal 1.2s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes heroReveal {
    from { opacity: 0; transform: translateY(40px) scale(0.95); filter: blur(10px); }
    to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.hero-desc {
    font-size: 1.25rem;
    max-width: 800px;
    margin: 0 auto 4rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* Author Tags Directory */
.author-directory {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    max-width: 900px;
    margin: 0 auto;
}

.author-tag {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.6rem 1.2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 99px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.author-tag:hover {
    background: var(--primary-gold);
    color: var(--bg-dark);
    border-color: var(--primary-gold);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 20px -5px rgba(251, 191, 36, 0.4);
}

/* Main Container */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem 6rem;
}

/* Widget Layout */
.widget-row {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 2rem;
    margin-bottom: 6rem;
}

@media (max-width: 1024px) {
    .widget-row { grid-template-columns: 1fr; }
}

/* Daily Widget - Premium Glass Card */
.daily-widget {
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    padding: 3rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-premium);
    transition: all 0.5s ease;
}

.daily-widget::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.date-display {
    font-size: 0.8rem;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    margin-bottom: 2rem;
    display: block;
    font-weight: 700;
}

.daily-quote-text {
    font-family: 'Yomogi', cursive;
    font-size: 2.5rem;
    line-height: 1.3;
    margin-bottom: 2rem;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.daily-author {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.daily-author::before {
    content: '';
    width: 40px;
    height: 1px;
    background: var(--glass-border);
}

/* Search Bar - Modern Floating Style */
.search-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#quote-search {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    padding: 1.5rem 2.5rem;
    border-radius: 20px;
    font-size: 1.1rem;
    color: white;
    width: 100%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}

#quote-search:focus {
    background: rgba(30, 41, 59, 0.8);
    border-color: var(--accent-blue);
    outline: none;
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -15px rgba(56, 189, 248, 0.3);
}

/* Filters */
.filter-container {
    margin-bottom: 5rem;
    text-align: center;
}

.category-filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.filter-btn {
    padding: 0.8rem 2rem;
    border: 1px solid var(--glass-border);
    border-radius: 99px;
    background: var(--glass-bg);
    color: var(--text-main);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-btn:hover, .filter-btn.active {
    background: white;
    color: var(--bg-dark);
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -10px rgba(255,255,255,0.3);
}

/* Situation Filter (Dropdown) */
.situation-filters-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.filter-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    font-weight: 500;
}

.situation-select {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    padding: 0.8rem 2.5rem 0.8rem 1.5rem;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    min-width: 280px;
    box-shadow: var(--shadow-deep);
}

.situation-select:hover {
    border-color: var(--primary-gold);
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.15);
}

.situation-select:focus {
    outline: none;
    border-color: var(--primary-gold);
}

.situation-select option {
    background: #0a0a0a;
    color: white;
}

/* Quote Grid - Dynamic Masonry Style */
.quote-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
    padding: 4rem 0;
}

/* Premium Quote Card */
.sticky-wrapper {
    perspective: 1200px;
}

.sticky-note {
    width: 100%;
    height: 380px;
    position: relative;
    cursor: pointer;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-style: preserve-3d;
}

.sticky-front, .sticky-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    box-shadow: var(--shadow-premium);
}

.sticky-front {
    justify-content: space-between;
    overflow: hidden;
}

.sticky-front::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
}

.sticky-note-content {
    font-family: 'Yomogi', cursive;
    font-size: 1.6rem;
    line-height: 1.4;
    color: #fff;
    margin-top: 1rem;
    position: relative;
}

.sticky-note-author {
    text-align: right;
    font-weight: 900;
    font-size: 1rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

.card-share-x {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.card-share-x:hover {
    background: #000;
    border-color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.card-link {
    display: block;
    font-size: 0.85rem;
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 900;
    letter-spacing: 0.1em;
    transition: all 0.3s ease;
}

.card-link:hover {
    color: #fff;
    transform: translateX(5px);
}

/* Specific Category Colors - Refined for Dark UI */
.cat-entrepreneur .sticky-front { border-left: 4px solid #38bdf8; }
.cat-passionate .sticky-front { border-left: 4px solid #f87171; }
.cat-unique .sticky-front { border-left: 4px solid #34d399; }
.cat-comedy .sticky-front { border-left: 4px solid #fbbf24; }

.sticky-back {
    transform: rotateY(180deg);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    justify-content: center;
}

.sticky-note.is-flipped {
    transform: rotateY(180deg);
}

/* Quiz UI - Integrated Experience */
.quiz-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 4rem;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(10px);
}

.quiz-question {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    color: #fff;
    font-family: 'Yomogi', cursive;
    margin-bottom: 3rem;
}

.choice-btn {
    padding: 1.25rem 2rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s;
}

.choice-btn:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.02);
    border-color: var(--accent-blue);
}

/* Modal / Detail View */
.modal-overlay {
    background: rgba(2, 6, 23, 0.9);
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    max-width: 800px;
}

.modal-header {
    background: rgba(255,255,255,0.02);
    padding: 2rem 3rem;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h3 {
    color: white;
}

.modal-body {
    padding: 4rem 3rem;
}

.quote-big {
    font-size: clamp(2rem, 5vw, 3rem);
    border-left: 6px solid var(--accent-blue);
    padding-left: 2rem;
    color: #fff;
}

/* Footer - Premium Finish */
footer {
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(20px);
    padding: 6rem 2rem;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

footer nav a {
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
    margin: 0 1.5rem;
    transition: color 0.3s;
}

footer nav a:hover {
    color: #fff;
}

/* Utility Classes */
.trending-badge {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    padding: 0.4rem 1rem;
    font-size: 0.7rem;
    font-weight: 900;
    border-radius: 99px;
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header { padding: 1rem; }
    .hero-section { padding: 6rem 1rem 4rem; }
    .daily-widget { padding: 2rem; }
    .daily-quote-text { font-size: 1.8rem; }
    .quote-grid { grid-template-columns: 1fr; }
    .modal-body { padding: 2.5rem 1.5rem; }
}
