/* ============================================
   GAL-CALENDAR: ギャル豚の日替わり名言
   2D演出版（ブラウザ互換性重視）
   ============================================ */

/* --- Section --- */
.gal-calendar-section {
    padding: 5rem 1.5rem;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    position: relative;
    overflow: hidden;
}
.gal-calendar-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,105,180,0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(147,112,219,0.08) 0%, transparent 50%);
    pointer-events: none;
}

.gal-section-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    text-align: center;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(255,105,180,0.3);
}
.gal-section-subtitle {
    text-align: center;
    color: rgba(255,255,255,0.6);
    font-family: var(--font-maru), sans-serif;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* --- Widget (top page teaser) --- */
.gal-calendar-widget {
    max-width: 380px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* --- Widget Card (simple, no 3D) --- */
.gal-widget-card {
    width: 220px;
    height: 330px;
    margin: 0 auto 1.5rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    transition: transform 0.3s, box-shadow 0.3s;
}
.gal-widget-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.gal-widget-card-back,
.gal-widget-card-front {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s;
}
.gal-widget-card-back {
    background: linear-gradient(135deg, #2d1b69, #11998e);
    border: 3px solid rgba(255,215,0,0.5);
    border-radius: 16px;
}
.gal-widget-card-back::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 10px;
    pointer-events: none;
}
.gal-widget-card-front {
    background: #fff;
    opacity: 0;
    padding: 1rem;
    border-radius: 16px;
}
.gal-widget-card.revealed .gal-widget-card-back { opacity: 0; }
.gal-widget-card.revealed .gal-widget-card-front { opacity: 1; }

.gal-widget-emblem {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 10px rgba(255,215,0,0.5));
    animation: widgetFloat 3s ease-in-out infinite;
}
@keyframes widgetFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.gal-widget-label {
    color: rgba(255,215,0,0.7);
    font-family: var(--font-serif), serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.3em;
}
.gal-widget-front-img {
    width: 150px;
    height: 220px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}
.gal-widget-front-name {
    font-family: var(--font-maru), sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-dark, #332F2C);
}
.gal-widget-front-type {
    font-size: 0.75rem;
    color: #999;
    font-family: var(--font-maru), sans-serif;
}

/* --- Quote display under card --- */
.gal-quote-area {
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    min-height: 80px;
}
.gal-quote-area.visible {
    opacity: 1;
    transform: translateY(0);
}
.gal-quote-text {
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.7;
    margin-bottom: 0.5rem;
    font-family: var(--font-serif), serif;
}
.gal-quote-area { cursor: pointer; }
.gal-quote-meta {
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    font-family: var(--font-maru), sans-serif;
}
.gal-widget-indicator {
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
    text-align: center;
    margin-top: 0.5rem;
    font-family: monospace;
    letter-spacing: 0.1em;
}
.gal-quote-meta .gal-char-name {
    color: rgba(255,255,255,0.8);
    font-weight: 700;
}

/* Tap prompt */
.gal-tap-prompt {
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
    font-family: var(--font-maru), sans-serif;
    margin-top: 0.5rem;
    animation: tapPulse 2s ease-in-out infinite;
}
@keyframes tapPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* More button */
.gal-more-btn {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.6rem 2rem;
    background: linear-gradient(135deg, rgba(255,105,180,0.2), rgba(147,112,219,0.2));
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50px;
    color: #fff;
    font-family: var(--font-maru), sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
}
.gal-more-btn:hover {
    background: linear-gradient(135deg, rgba(255,105,180,0.4), rgba(147,112,219,0.4));
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255,105,180,0.3);
}

/* --- Loading --- */
.gal-loading {
    color: rgba(255,255,255,0.5);
    font-family: var(--font-maru), sans-serif;
    padding: 4rem 0;
    text-align: center;
}

/* ============================================
   POPUP / MODAL
   ============================================ */
.gal-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 30, 0.92);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.gal-popup-overlay.open {
    display: flex;
}

.gal-popup-container {
    background: #fff;
    border-radius: 24px;
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem 1.5rem;
    position: relative;
    animation: popupSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
@keyframes popupSlideUp {
    0% { transform: translateY(40px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.gal-popup-close {
    position: absolute;
    top: 12px; right: 16px;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    color: #666;
    z-index: 1;
}
.gal-popup-close:hover { background: #ddd; }

/* Rare character badge */
.gal-popup-rare {
    text-align: center;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #fff;
    font-weight: 900;
    font-family: var(--font-maru), sans-serif;
    border-radius: 50px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    animation: rarePulse 1.5s ease-in-out infinite;
    box-shadow: 0 4px 15px rgba(255,215,0,0.3);
}
@keyframes rarePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 15px rgba(255,215,0,0.3); }
    50% { transform: scale(1.03); box-shadow: 0 4px 25px rgba(255,215,0,0.5); }
}

.gal-popup-character { text-align: center; margin-bottom: 1rem; }
.gal-popup-character-img {
    width: 200px; height: 300px;
    object-fit: contain;
    margin: 0 auto; display: block;
}
.gal-popup-character-img.has-bg { border-radius: 16px; }

/* Commentary speech bubble */
.gal-popup-commentary-wrap {
    margin: 0.5rem 0 1.2rem;
    padding: 0 0.25rem;
}
.gal-popup-commentary-bubble {
    position: relative;
    border-left: 4px solid #FF69B4;
    border-radius: 0 14px 14px 0;
    padding: 1rem 1.2rem;
    background: linear-gradient(135deg, rgba(255,105,180,0.07), rgba(255,182,193,0.03));
}
.gal-popup-commentary-bubble::before {
    content: '💭';
    position: absolute;
    top: -12px;
    left: -2px;
    font-size: 1.1rem;
}
.gal-popup-commentary-text {
    font-size: 1.05rem;
    line-height: 1.85;
    color: #444;
    font-family: var(--font-maru), sans-serif;
}
/* Footer (date + card no) */
.gal-popup-footer {
    text-align: center;
    margin-bottom: 1rem;
}
.gal-popup-date {
    font-size: 0.85rem; color: #aaa;
    font-family: var(--font-maru), sans-serif; margin-bottom: 0.2rem;
}
.gal-popup-card-no {
    font-size: 0.72rem; color: #bbb;
    font-family: monospace;
    letter-spacing: 0.05em;
}

/* Action buttons */
.gal-popup-actions { display: flex; gap: 10px; }
.gal-btn {
    flex: 1; padding: 14px 10px; border-radius: 14px; border: none;
    font-family: var(--font-maru), sans-serif; font-weight: 700;
    font-size: 0.9rem; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    -webkit-tap-highlight-color: transparent;
}
.gal-btn-share { background: #1DA1F2; color: #fff; }
.gal-btn-share:hover { background: #0d8bd9; }
.gal-btn-save { background: #f0f0f0; color: #333; }
.gal-btn-save:hover { background: #e0e0e0; }
.gal-btn-okawari {
    background: linear-gradient(135deg, #FF8C00, #FFD700);
    color: #fff;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    width: 100%;
    margin-top: 4px;
}
.gal-btn-okawari:hover { background: linear-gradient(135deg, #FF7700, #FFC800); }
.gal-btn-okawari:active { transform: scale(0.95); }

/* Okawari stop overlay (inside reveal overlay) */
.gal-okawari-stop {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.gal-okawari-stop.active {
    opacity: 1;
    transform: scale(1);
}
.gal-okawari-stop-face {
    font-size: 6rem;
    margin-bottom: 1.5rem;
    animation: okawari-shake 0.6s ease 0.3s;
}
@keyframes okawari-shake {
    0%, 100% { transform: rotate(0) scale(1); }
    15% { transform: rotate(-12deg) scale(1.1); }
    30% { transform: rotate(12deg) scale(1.1); }
    45% { transform: rotate(-8deg) scale(1.05); }
    60% { transform: rotate(8deg) scale(1.05); }
    75% { transform: rotate(-3deg); }
}
.gal-okawari-stop-msg {
    color: #fff;
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    line-height: 2;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
    padding: 0 2rem;
    margin-bottom: 2rem;
}
.gal-okawari-stop-close {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.5);
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    padding: 0.8rem 2.5rem;
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.3s;
}
.gal-okawari-stop-close:hover {
    background: rgba(255,255,255,0.35);
}

/* ============================================
   REVEAL OVERLAY (full-screen 2D animation)
   ============================================ */
.gal-reveal-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a1a 100%);
    z-index: 3000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.gal-reveal-overlay.open {
    display: flex;
    animation: revealFadeIn 0.5s ease-out;
}
@keyframes revealFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.gal-reveal-status {
    color: rgba(255,255,255,0.6);
    font-family: var(--font-maru), sans-serif;
    font-size: 0.95rem;
    margin-bottom: 2rem;
    min-height: 1.5em;
    text-align: center;
}

/* Reveal card: 2D approach — no 3D transforms */
.gal-reveal-card-area {
    width: 260px;
    height: 390px;
    position: relative;
    z-index: 1;
}

.gal-reveal-card {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

/* Back and front are overlapping layers, toggled via opacity */
.gal-reveal-back,
.gal-reveal-front {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

.gal-reveal-back {
    background: linear-gradient(135deg, #2d1b69, #11998e);
    border: 3px solid rgba(255,215,0,0.5);
    border-radius: 20px;
    z-index: 2;
    transition: background 0.8s ease, border-color 0.8s ease, box-shadow 0.8s ease;
}
.gal-reveal-card.bonus .gal-reveal-back {
    box-shadow: 0 0 30px rgba(255,215,0,0.5);
}
.gal-reveal-back::before {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 14px;
    pointer-events: none;
}
.gal-reveal-card.bonus .gal-reveal-back {
    background: linear-gradient(135deg, #8B6914, #DAA520, #FFD700, #DAA520, #8B6914);
    border-color: rgba(255,255,255,0.6);
}

.gal-reveal-front {
    background: #fff;
    padding: 1.5rem 1rem;
    border-radius: 20px;
    z-index: 1;
}

.gal-reveal-emblem {
    font-size: 5rem;
    filter: drop-shadow(0 0 15px rgba(255,215,0,0.5));
}
.gal-reveal-back-label {
    color: rgba(255,215,0,0.8);
    font-family: var(--font-serif), serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    margin-top: 0.5rem;
}

.gal-reveal-front-img {
    width: 180px;
    height: 270px;
    object-fit: contain;
}
.gal-reveal-front-name {
    font-family: var(--font-maru), sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--text-dark, #332F2C);
    margin-top: 0.5rem;
}

/* Glow effect around card */
.gal-reveal-glow {
    position: absolute;
    inset: -20px;
    border-radius: 30px;
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.5s;
}
.gal-reveal-glow.active {
    opacity: 1;
    animation: glowPulse 1.5s ease-in-out infinite;
}
@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(255,215,0,0.3), 0 0 60px rgba(255,105,180,0.2); }
    50% { box-shadow: 0 0 50px rgba(255,215,0,0.6), 0 0 100px rgba(255,105,180,0.3); }
}

/* Sparkle particles */
.gal-sparkle-container {
    position: absolute;
    inset: -40px;
    pointer-events: none;
    overflow: hidden;
    z-index: 3;
}
.gal-sparkle {
    position: absolute;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #FFD700;
    opacity: 0;
}
.gal-sparkle.active {
    animation: sparkleFloat 2s ease-out forwards;
}
@keyframes sparkleFloat {
    0% { opacity: 0; transform: translateY(0) scale(0); }
    20% { opacity: 1; transform: translateY(-10px) scale(1); }
    100% { opacity: 0; transform: translateY(-80px) scale(0.3); }
}

/* --- Animation classes applied via JS --- */

/* Stage: appear */
.gal-reveal-card.anim-appear {
    animation: cardAppear 1.2s ease-out forwards;
}
@keyframes cardAppear {
    0% { transform: scale(0.3) rotate(10deg); opacity: 0; }
    60% { transform: scale(1.05) rotate(-2deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Stage: tremble */
.gal-reveal-card.anim-tremble {
    animation: cardTremble 0.1s linear infinite;
}
@keyframes cardTremble {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-2px, 1px) rotate(-0.5deg); }
    50% { transform: translate(1px, -1px) rotate(0.5deg); }
    75% { transform: translate(-1px, -1px) rotate(-0.3deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

/* Stage: lift */
.gal-reveal-card.anim-lift {
    animation: cardLift 1.5s ease-in-out forwards;
}
@keyframes cardLift {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-25px) scale(1.06); }
}

/* Stage: squeeze (horizontal compress) */
.gal-reveal-card.anim-squeeze {
    animation: cardSqueeze 0.4s ease-in forwards;
}
@keyframes cardSqueeze {
    0% { transform: translateY(-25px) scale(1.06); }
    100% { transform: translateY(-25px) scaleX(0); }
}

/* Stage: expand (horizontal expand, showing front) */
.gal-reveal-card.anim-expand {
    animation: cardExpand 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes cardExpand {
    0% { transform: translateY(-25px) scaleX(0); }
    100% { transform: translateY(0) scaleX(1) scale(1); }
}

/* Stage: bounce */
.gal-reveal-card.anim-bounce {
    animation: cardBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes cardBounce {
    0% { transform: scale(0.95); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* Reveal quote area */
.gal-reveal-quote {
    margin-top: 2rem;
    text-align: center;
    max-width: 340px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.8s ease;
}
.gal-reveal-quote.visible {
    opacity: 1;
    transform: translateY(0);
}
.gal-reveal-quote-text {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.8;
    font-family: var(--font-serif), serif;
    margin-bottom: 0.75rem;
}
.gal-reveal-quote-meta {
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
    font-family: var(--font-maru), sans-serif;
}

/* Skip / close button */
.gal-reveal-skip {
    position: absolute;
    bottom: max(40px, env(safe-area-inset-bottom, 20px) + 20px);
    padding: 0.7rem 2rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50px;
    color: rgba(255,255,255,0.5);
    font-family: var(--font-maru), sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}
.gal-reveal-skip:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* Flash effect */
.gal-reveal-flash {
    position: absolute;
    inset: 0;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 380px) {
    .gal-widget-card { width: 190px; height: 285px; }
    .gal-reveal-card-area { width: 220px; height: 330px; }
    .gal-section-title { font-size: 1.5rem; }
}
@media (min-width: 768px) {
    .gal-calendar-section { padding: 6rem 2rem; }
    .gal-widget-card { width: 240px; height: 360px; }
    .gal-section-title { font-size: 2.2rem; }
}
