@font-face {
    font-family: 'Gichogodic';
    src: url('/fonts/NoonnuBasicGothicRegular.otf') format('opentype'),
         url('/fonts/NoonnuBasicGothicRegular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --bg-main: #26150F;
    --bg-surface: #593A28;
    --primary: #D9D9D9;
    --secondary: #A67A60;
    --text-body: #BFBFBF;
    --text-mute: #A67A60;
    --radius: 4px;
}

body.light-mode {
    --bg-main: #F5F0EB;
    --bg-surface: #E8E0D8;
    --primary: #26150F;
    --secondary: #593A28;
    --text-body: #26150F;
    --text-mute: #593A28;
}

* { 
    font-family: 'Gichogodic', sans-serif; 
    box-sizing: border-box; 
}

body {
    background-color: var(--bg-main);
    color: var(--text-body);
    margin: 0;
    line-height: 1.7;
    overflow-x: hidden;
}

a { 
    color: inherit; 
    text-decoration: none; 
    transition: 0.3s; 
}

a:hover { 
    color: var(--secondary); 
}

.container { 
    max-width: 1000px; 
    margin: 0 auto; 
    padding: 0 40px; 
    min-height: 100vh; 
}

nav {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    height: 90px;
    margin-bottom: 60px;
    border-bottom: 1px solid rgba(217, 217, 217, 0.1);
}

nav .logo { 
    font-size: 1.3rem; 
    font-weight: normal; 
    letter-spacing: 2px; 
    color: var(--primary); 
}

nav .nav-right {
    display: flex;
    align-items: center;
    gap: 30px;
}

nav ul.desktop-menu { 
    display: flex; 
    gap: 30px; 
    list-style: none; 
    padding: 0; 
    margin: 0; 
}

nav ul.desktop-menu li a { 
    font-size: 0.95rem; 
    color: var(--text-mute); 
}

nav ul.desktop-menu li a:hover { 
    color: var(--primary); 
}

.mobile-menu-btn { 
    display: none; 
    font-size: 1.8rem; 
    cursor: pointer; 
    color: var(--primary); 
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    height: 100vh;
    width: 280px;
    flex-direction: column;
    gap: 0;
    background: var(--bg-main);
    padding: 100px 0 0 0;
    transition: right 0.3s ease;
    z-index: 10000;
    box-shadow: -8px 0 30px rgba(0,0,0,0.9);
    overflow-y: auto;
    margin: 0;
    list-style: none;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu li {
    width: 100%;
    margin: 0;
}

.mobile-menu li a {
    display: block;
    padding: 22px 30px;
    color: var(--primary);
    border-bottom: 1px solid rgba(217, 217, 217, 0.1);
    font-size: 1.05rem;
    background: transparent;
}

.mobile-menu li a:active {
    background: rgba(166, 122, 96, 0.3);
}

.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
}

.menu-overlay.active {
    display: block;
}

.theme-toggle {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-mute);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    padding: 0;
}

.theme-toggle:hover {
    color: var(--primary);
}

.btn-primary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 12px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary);
    color: var(--bg-main);
}

.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid rgba(217, 217, 217, 0.2);
}

.chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 40px 0;
    border-bottom: 1px solid rgba(217, 217, 217, 0.2);
    cursor: pointer;
    transition: all 0.4s ease;
}

.chapter-item:hover {
    padding-left: 20px;
    background: linear-gradient(90deg, rgba(217, 217, 217, 0.05), transparent);
}

.chapter-info h3 {
    font-size: 1.8rem;
    margin: 0 0 10px 0;
    color: var(--primary);
    font-weight: normal;
}

.chapter-info p {
    margin: 0;
    color: var(--text-mute);
    font-size: 0.95rem;
    font-weight: lighter;
}

.chapter-arrow {
    font-size: 1.5rem;
    color: var(--secondary);
    opacity: 0;
    transition: 0.3s;
    transform: translateX(-10px);
}

.chapter-item:hover .chapter-arrow {
    opacity: 1;
    transform: translateX(0);
}

.card {
    background: var(--bg-surface);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border: none;
}

.timeline-content { 
    background: var(--bg-surface); 
    border: none; 
    color: var(--text-body); 
}

.timeline-year { 
    color: var(--primary); 
}

.paper-card { 
    background: #EAE5E1; 
    color: #333; 
}

.paper-textarea { 
    color: #333; 
}

.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99;
}

.chat-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-size: 1.8rem;
}

.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    display: none;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    background: var(--bg-surface);
    border: 1px solid #555;
    color: var(--text-body);
    z-index: 100;
}

.chat-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    background: #221C19;
    color: var(--primary);
    border-bottom: 1px solid #444;
}

body.light-mode .chat-header {
    background: #D9D0C7;
    border-bottom: 1px solid #ccc;
}

.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-surface);
}

.chat-msg {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-msg.user {
    align-self: flex-end;
    background: var(--secondary);
    color: #fff;
}

.chat-msg.bot {
    align-self: flex-start;
    background: #4D423D;
    color: #E0DCD8;
}

body.light-mode .chat-msg.bot {
    background: #D9D0C7;
    color: #26150F;
}

.chat-input {
    display: flex;
    padding: 10px;
    border-top: 1px solid #444;
}

body.light-mode .chat-input {
    border-top: 1px solid #ccc;
}

.chat-input input {
    flex: 1;
    padding: 10px;
    border: none;
    outline: none;
    border-radius: 20px;
    margin-right: 10px;
    background: var(--bg-main);
    color: var(--text-body);
}

.chat-input button {
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    background: var(--bg-main);
    color: var(--primary);
}

.asmr-widget {
    position: fixed;
    bottom: 110px;
    right: 30px;
    z-index: 99;
}

.asmr-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-size: 1.8rem;
}

.asmr-btn.active {
    background: var(--primary);
    color: var(--bg-main);
}

.asmr-controls {
    display: none;
    position: absolute;
    bottom: 70px;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid #555;
    border-radius: 12px;
    padding: 10px;
    min-width: 150px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

body.light-mode .asmr-controls {
    border: 1px solid #ccc;
}

.asmr-option {
    padding: 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.asmr-option:hover {
    background: rgba(0,0,0,0.05);
}

.pwa-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: none;
    align-items: center;
    gap: 15px;
    z-index: 10000;
    max-width: 90%;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
}

.bank-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.bank-card {
    padding: 20px;
    border: 1px solid #555;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
}

.bank-card:hover {
    background: rgba(255,255,255,0.05);
    transform: translateY(-2px);
}

.bank-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 60px 0;
}

.login-box {
    background: var(--bg-surface);
    padding: 50px 45px;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid rgba(217, 217, 217, 0.1);
}

.login-field {
    margin-bottom: 25px;
}

.login-label {
    display: block;
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.login-input {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid rgba(217, 217, 217, 0.2);
    border-radius: 8px;
    background: rgba(38, 21, 15, 0.5);
    color: var(--text-body);
    font-size: 1rem;
    transition: all 0.3s;
    outline: none;
}

body.light-mode .login-input {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(89, 58, 40, 0.2);
}

.login-input:focus {
    border-color: var(--secondary);
    background: rgba(38, 21, 15, 0.7);
}

body.light-mode .login-input:focus {
    background: rgba(255, 255, 255, 0.8);
}

.login-input::placeholder {
    color: rgba(191, 191, 191, 0.4);
}

body.light-mode .login-input::placeholder {
    color: rgba(38, 21, 15, 0.4);
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
    letter-spacing: 1px;
}

.btn-login:hover {
    background: #8F6A50;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(166, 122, 96, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.social-section {
    margin: 120px 0 80px 0;
    padding: 80px 0;
    background: var(--bg-surface);
    border-radius: 20px;
    border: 1px solid rgba(217, 217, 217, 0.05);
}

.social-modern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.social-modern-card {
    background: var(--bg-main);
    padding: 35px 25px;
    border-radius: 16px;
    border: 1px solid rgba(166, 122, 96, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.social-modern-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--secondary);
    box-shadow: 0 15px 40px rgba(166, 122, 96, 0.3);
}

.social-modern-icon {
    font-size: 3.5rem;
    filter: grayscale(0.3);
    transition: all 0.3s;
}

.social-modern-card:hover .social-modern-icon {
    filter: grayscale(0);
    transform: scale(1.1) rotate(5deg);
}

.social-modern-content {
    text-align: center;
    width: 100%;
}

.social-modern-label {
    color: var(--secondary);
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
    opacity: 0.8;
}

.social-modern-value {
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: normal;
    word-break: break-word;
}

.write-section {
    margin-bottom: 50px;
    animation: fadeInUp 0.6s ease-out;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.title-icon {
    font-size: 2rem;
}

.title-text {
    font-size: 1.3rem;
    color: var(--primary);
    font-weight: normal;
}

.emotion-select-modern,
.link-input,
.nickname-input-modern {
    width: 100%;
    padding: 18px 24px;
    background: rgba(89, 58, 40, 0.4);
    border: 2px solid rgba(217, 217, 217, 0.1);
    border-radius: 14px;
    color: var(--text-body);
    font-size: 1.1rem;
    transition: all 0.3s;
    outline: none;
}

body.light-mode .emotion-select-modern,
body.light-mode .link-input,
body.light-mode .nickname-input-modern {
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(89, 58, 40, 0.2);
}

.emotion-select-modern {
    cursor: pointer;
}

.emotion-select-modern:focus,
.link-input:focus,
.nickname-input-modern:focus {
    background: rgba(89, 58, 40, 0.6);
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(166, 122, 96, 0.2);
}

body.light-mode .emotion-select-modern:focus,
body.light-mode .link-input:focus,
body.light-mode .nickname-input-modern:focus {
    background: rgba(255, 255, 255, 0.9);
}

.story-input {
    width: 100%;
    padding: 25px;
    background: rgba(89, 58, 40, 0.4);
    border: 2px solid rgba(217, 217, 217, 0.1);
    border-radius: 14px;
    color: var(--text-body);
    font-size: 1.1rem;
    line-height: 1.9;
    resize: vertical;
    min-height: 350px;
    transition: all 0.3s;
    outline: none;
}

body.light-mode .story-input {
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(89, 58, 40, 0.2);
}

.story-input:focus {
    background: rgba(89, 58, 40, 0.6);
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(166, 122, 96, 0.2);
}

body.light-mode .story-input:focus {
    background: rgba(255, 255, 255, 0.9);
}

.char-count {
    text-align: right;
    color: var(--text-mute);
    font-size: 0.9rem;
    margin-top: 10px;
}

.image-upload-area {
    position: relative;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    background: rgba(89, 58, 40, 0.3);
    border: 2px dashed rgba(166, 122, 96, 0.4);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

body.light-mode .upload-label {
    background: rgba(255, 255, 255, 0.4);
    border: 2px dashed rgba(89, 58, 40, 0.4);
}

.upload-label:hover {
    background: rgba(89, 58, 40, 0.5);
    border-color: var(--secondary);
    transform: translateY(-3px);
}

body.light-mode .upload-label:hover {
    background: rgba(255, 255, 255, 0.7);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.upload-text {
    font-size: 1.15rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 0.95rem;
    color: var(--text-mute);
}

.image-preview-container {
    display: none;
}

.button-group {
    margin-top: 70px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.submit-btn {
    width: 100%;
    padding: 22px;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.4s;
    box-shadow: 0 10px 30px rgba(166, 122, 96, 0.4);
}

.submit-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(166, 122, 96, 0.6);
}

.submit-btn:active {
    transform: translateY(-1px);
}

.cancel-btn {
    width: 100%;
    padding: 18px;
    background: transparent;
    color: var(--text-mute);
    border: 2px solid rgba(217, 217, 217, 0.2);
    border-radius: 14px;
    font-size: 1.05rem;
    text-align: center;
    transition: all 0.3s;
    display: block;
}

.cancel-btn:hover {
    background: rgba(217, 217, 217, 0.05);
    color: var(--primary);
    border-color: rgba(217, 217, 217, 0.3);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .container { 
        padding: 0 20px; 
    }
    
    nav ul.desktop-menu {
        display: none;
    }
    
    .mobile-menu-btn { 
        display: block;
    }
    
    .mobile-menu {
        display: flex;
    }
    
    .chapter-item { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 15px; 
    }
    
    .chapter-arrow { 
        display: none; 
    }
    
    .login-box {
        padding: 40px 30px;
    }
    
    .social-modern-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .social-modern-card {
        padding: 30px 20px;
    }
    
    .social-section {
        margin: 80px -20px 60px -20px;
        border-radius: 0;
    }
    
    .write-section {
        margin-bottom: 40px;
    }
    
    .story-input {
        min-height: 280px;
        font-size: 1.05rem;
    }
    
    .emotion-select-modern,
    .link-input,
    .nickname-input-modern {
        font-size: 1.05rem;
    }
}
