@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@400;700&display=swap');

body {
    background: linear-gradient(135deg, #075985 0%, #0c4a6e 40%, #0f172a 100%);
    background-attachment: fixed;
    font-family: 'Noto Serif KR', serif;
    -webkit-tap-highlight-color: transparent;
}

/* Poem Card */
.poem-card {
    background-color: #faf9f5;
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.5);
    min-height: 720px;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.poem-bg-img {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65%;
    object-fit: cover;
    z-index: 0;
    filter: sepia(10%) brightness(100%);
    transform-origin: center center;
    transition: transform 0.1s ease-out;
    pointer-events: none;
}

.poem-gradient-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom,
        rgba(250, 249, 245, 1) 0%, rgba(250, 249, 245, 1) 35%,
        rgba(250, 249, 245, 0.95) 45%, rgba(250, 249, 245, 0.4) 75%,
        rgba(250, 249, 245, 0) 100%
    );
    z-index: 1;
}

.poem-content {
    position: relative;
    z-index: 10;
    padding: 2.5rem 1.5rem;
    color: #1a1a1a;
}

@media (min-width: 640px) {
    .poem-content { padding: 3.5rem 2.5rem; }
}

/* Loading */
.loading-spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Editable */
[contenteditable="true"]:focus {
    outline: 2px solid rgba(59, 130, 246, 0.2);
    background: rgba(0,0,0,0.02);
    border-radius: 4px;
}

/* Chips */
.chip {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
}

.chip.active {
    background: #38bdf8;
    color: #0c4a6e;
    border-color: #38bdf8;
    font-weight: 800;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

/* Premium Button */
.premium-btn {
    background: linear-gradient(to right, #0284c7, #38bdf8);
    box-shadow: 0 4px 18px rgba(2, 132, 199, 0.35);
    border: none !important;
    color: white !important;
}

/* Image Preview */
#image-preview {
    transform-origin: center center;
    transition: transform 0.1s ease-out;
    touch-action: none;
    cursor: move;
    user-select: none;
    -webkit-user-drag: none;
    max-width: none;
    max-height: none;
}

#drop-zone {
    position: relative;
    overflow: hidden;
}

/* Auth Form */
.auth-container {
    max-width: 420px;
    margin: 0 auto;
}

.auth-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: white;
    outline: none;
    transition: all 0.2s;
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.auth-input:focus {
    ring: 2px;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.3);
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: 0.75rem;
    transition: all 0.2s;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
}

.auth-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.auth-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    display: none;
}

.auth-error.show {
    display: block;
}

/* User info in header */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.5);
}

.acct-settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 4px;
}

.acct-settings-btn:hover {
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.8);
}

.logout-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 0.25rem 0.625rem;
    border-radius: 0.5rem;
    font-size: 0.625rem;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Navigation */
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.nav-link:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link-active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

.nav-link-active:hover {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
}

/* Poems Gallery Grid */
.poems-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 480px) {
    .poems-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Gallery Card */
.poem-gallery-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.25rem;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

.poem-gallery-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(56, 189, 248, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px -10px rgba(0, 0, 0, 0.3);
}

.poem-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.poem-gallery-tags {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.poem-tag {
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    letter-spacing: 0.025em;
}

.poem-tag-type {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
}

.poem-tag-mood {
    background: rgba(168, 85, 247, 0.15);
    color: #c4b5fd;
}

.poem-delete-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.2);
    padding: 0.25rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.poem-delete-btn:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

/* 모바일: 다운로드 버튼 항상 표시 */
@media (hover: none) {
    #modal-download-btn {
        opacity: 1 !important;
    }
}

.poem-gallery-thumb {
    width: 100%;
    height: 110px;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.poem-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.poem-gallery-body {
    flex: 1;
    margin-bottom: 0.75rem;
}

.poem-gallery-text {
    font-size: 0.8125rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    white-space: pre-wrap;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
}

.poem-gallery-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.poem-gallery-author {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #7dd3fc;
}

.poem-gallery-date {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.25);
}

/* ─────────────────────────────────────
   배너 광고
   ───────────────────────────────────── */
.ad-banner-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    display: flex;
    justify-content: center;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.demo-banner-ad {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    max-width: 400px;
    width: 100%;
}

.demo-ad-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 900;
    color: white;
    letter-spacing: 0.5px;
}

.demo-ad-title {
    font-size: 0.6875rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    line-height: 1.3;
}

.demo-ad-sub {
    font-size: 0.5625rem;
    color: rgba(255, 255, 255, 0.3);
    margin: 0;
    margin-top: 1px;
}

/* ─────────────────────────────────────
   인터스티셜 (전면) 광고
   ───────────────────────────────────── */
.interstitial-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s;
    pointer-events: none;
}

.interstitial-overlay.show {
    background: rgba(0, 0, 0, 0.92);
    pointer-events: all;
}

.interstitial-container {
    width: 100%;
    max-width: 380px;
    padding: 0 1rem;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.interstitial-overlay.show .interstitial-container {
    opacity: 1;
    transform: scale(1);
}

.interstitial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.interstitial-ad-badge {
    font-size: 9px;
    font-weight: 900;
    color: #facc15;
    background: rgba(250, 204, 21, 0.15);
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 1px;
}

.interstitial-skip {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.375rem 0.875rem;
    border-radius: 0.5rem;
    cursor: not-allowed;
    transition: all 0.2s;
}

.interstitial-skip.active {
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
}

.interstitial-skip.active:hover {
    background: rgba(255, 255, 255, 0.1);
}

.interstitial-body {
    text-align: center;
}

.interstitial-video-mock {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 1rem;
}

.interstitial-play-icon {
    opacity: 0.3;
    margin-bottom: 1rem;
}

.interstitial-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
}

.interstitial-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #0ea5e9, #38bdf8);
    border-radius: 3px;
}

.interstitial-cta {
    font-size: 0.8125rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 0.375rem 0;
}

.interstitial-note {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.2);
    margin: 0;
}
