* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    font-family: 'Noto Sans JP', sans-serif;
    background: #0a0806;
    color: #f5e6d3;
}

#map {
    position: absolute;
    inset: 0;
}

#map .maplibregl-ctrl-top-right,
#map .maplibregl-ctrl-top-left,
#map .maplibregl-ctrl-bottom-left,
#map .maplibregl-ctrl-bottom-right {
    display: none !important;
}

.vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(10, 8, 6, 0.45) 100%);
}

/* お題パネル */
.challenge-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: linear-gradient(
        to bottom,
        rgba(10, 8, 6, 0.88) 0%,
        rgba(10, 8, 6, 0.6) 80%,
        transparent 100%
    );
    padding: 8px 12px 18px;
    padding-top: max(8px, env(safe-area-inset-top));
    display: flex;
    align-items: flex-start;
    gap: 10px;
    pointer-events: none;
}

.challenge-panel > * {
    pointer-events: auto;
}

.challenge-thumb {
    position: relative;
    width: 80px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(201, 169, 110, 0.35);
    cursor: pointer;
    background: #15110d;
}

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

.challenge-thumb .title-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 18%;
    backdrop-filter: blur(16px);
    background: rgba(10, 8, 6, 0.6);
}

.challenge-info {
    flex: 1;
    min-width: 0;
    padding-top: 4px;
}

.challenge-label {
    font-size: 11px;
    opacity: 0.5;
    margin-bottom: 2px;
}

.challenge-q {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
}

.challenge-progress {
    font-size: 11px;
    opacity: 0.45;
    margin-top: 4px;
}

.challenge-quit {
    background: none;
    border: none;
    color: #f5e6d3;
    opacity: 0.4;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.challenge-quit:hover {
    opacity: 0.8;
}

/* ボトムUI */
.bottom-ui {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    padding: 0 max(14px, env(safe-area-inset-right)) 14px max(14px, env(safe-area-inset-left));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: linear-gradient(
        to top,
        rgba(10, 8, 6, 0.88) 0%,
        rgba(10, 8, 6, 0.5) 70%,
        transparent 100%
    );
    pointer-events: none;
}

.bottom-ui > * {
    pointer-events: auto;
}

.hint-box {
    width: 100%;
    max-width: 420px;
    padding: 10px 14px;
    background: rgba(30, 25, 18, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(201, 169, 110, 0.2);
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
}

.hint-text {
    opacity: 0.85;
}

.hint-more {
    display: inline-block;
    margin-top: 6px;
    font-size: 11px;
    opacity: 0.4;
    cursor: pointer;
    border: none;
    background: none;
    color: #f5e6d3;
    padding: 0;
}

.hint-more:hover {
    opacity: 0.7;
}

.guess-btn {
    padding: 14px 44px;
    border: 1px solid rgba(201, 169, 110, 0.5);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(201, 169, 110, 0.28), rgba(201, 169, 110, 0.1));
    color: #f5e6d3;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
    -webkit-tap-highlight-color: transparent;
}

.guess-btn:hover {
    background: linear-gradient(135deg, rgba(201, 169, 110, 0.45), rgba(201, 169, 110, 0.2));
    box-shadow: 0 4px 20px rgba(201, 169, 110, 0.25);
}

.guess-btn:active {
    transform: scale(0.95);
}

.sub-btns {
    display: flex;
    gap: 10px;
}

.sub-btn {
    padding: 7px 14px;
    border: 1px solid rgba(201, 169, 110, 0.25);
    border-radius: 9px;
    background: rgba(30, 25, 18, 0.6);
    color: #f5e6d3;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

/* フィードバック */
.feedback {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 35;
    padding: 16px 28px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.feedback.show {
    opacity: 1;
    animation: fbPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fbPop {
    from {
        transform: translate(-50%, -50%) scale(0.85);
    }

    to {
        transform: translate(-50%, -50%) scale(1);
    }
}

.feedback.correct {
    background: rgba(45, 142, 111, 0.9);
    color: #fff;
    box-shadow: 0 8px 30px rgba(45, 142, 111, 0.4);
}

.feedback.close {
    background: rgba(212, 136, 58, 0.9);
    color: #fff;
    box-shadow: 0 8px 30px rgba(212, 136, 58, 0.4);
}

.feedback.far {
    background: rgba(74, 111, 165, 0.85);
    color: #fff;
    box-shadow: 0 8px 30px rgba(74, 111, 165, 0.3);
}

/* フラッシュ */
.flash {
    position: fixed;
    inset: 0;
    z-index: 33;
    pointer-events: none;
    opacity: 0;
}

.flash.fire {
    animation: flashBang 0.8s ease-out forwards;
}

@keyframes flashBang {
    0% {
        opacity: 0;
        background: radial-gradient(circle, rgba(201, 169, 110, 0.7), transparent 60%);
    }

    15% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* 照準 */
.crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
    width: 28px;
    height: 28px;
    border: 2px solid rgba(201, 169, 110, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.crosshair::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background: rgba(201, 169, 110, 0.7);
    border-radius: 50%;
}

/* 発見オーバーレイ */
.disc-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 8, 6, 0.8);
    backdrop-filter: blur(4px);
}

.disc-overlay.show {
    display: flex;
}

.disc-card {
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(145deg, #1e1912, #2a221a);
    border: 1px solid rgba(201, 169, 110, 0.3);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(16px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.disc-img {
    width: 100%;
    overflow: hidden;
    border-radius: 18px 18px 0 0;
    background: #15110d;
    display: flex;
    align-items: center;
    justify-content: center;
}

.disc-img img {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    animation: imgReveal 0.8s 0.2s both;
}

@keyframes imgReveal {
    from {
        opacity: 0;
        filter: blur(10px);
    }

    to {
        opacity: 1;
        filter: none;
    }
}

.disc-body {
    padding: 18px 22px 22px;
}

.disc-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.disc-sub {
    font-size: 12px;
    opacity: 0.45;
    margin-bottom: 12px;
}

.disc-story {
    padding: 12px;
    background: rgba(201, 169, 110, 0.06);
    border-left: 3px solid rgba(201, 169, 110, 0.4);
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    line-height: 1.8;
    opacity: 0.85;
    margin-bottom: 16px;
    max-height: 120px;
    overflow-y: auto;
}

.disc-story .desc-title {
    font-size: 15px;
    font-weight: 700;
    margin: 8px 0 4px;
    color: #c9a96e;
}

.disc-story .desc-subtitle {
    font-size: 13px;
    font-weight: 700;
    margin: 6px 0 2px;
    color: rgba(201, 169, 110, 0.8);
}

.disc-story .desc-body {
    margin: 4px 0;
}

.disc-story .desc-quote {
    border-left: 2px solid rgba(201, 169, 110, 0.4);
    padding-left: 8px;
    margin: 4px 0;
    opacity: 0.8;
    font-style: italic;
}

.disc-story .desc-list {
    margin: 2px 0;
}

.disc-story hr {
    border: none;
    border-top: 1px solid rgba(201, 169, 110, 0.2);
    margin: 8px 0;
}

.disc-actions {
    display: flex;
    justify-content: center;
    margin-top: auto;
}

.disc-actions button {
    padding: 12px 28px;
    border: 1px solid rgba(201, 169, 110, 0.5);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(201, 169, 110, 0.25), rgba(201, 169, 110, 0.1));
    color: #f5e6d3;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* 出題プレビュー */
.preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 8, 6, 0.95);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.preview-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.preview-img {
    max-width: 80%;
    max-height: 50vh;
    border-radius: 10px;
    border: 1px solid rgba(201, 169, 110, 0.3);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    animation: previewZoom 1.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes previewZoom {
    from {
        transform: scale(0.85);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.preview-title {
    margin-top: 20px;
    font-size: 20px;
    font-weight: 700;
    color: #f5e6d3;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    animation: previewZoom 1.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.preview-sub {
    margin-top: 8px;
    font-size: 13px;
    color: rgba(201, 169, 110, 0.7);
    animation: previewZoom 1.5s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

.preview-countdown {
    margin-top: 24px;
    font-size: 32px;
    font-weight: 700;
    color: rgba(201, 169, 110, 0.6);
    min-height: 44px;
}

.preview-countdown span {
    display: inline-block;
    animation: countPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes countPop {
    from {
        transform: scale(1.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== 探索イントロオーバーレイ ===== */
.explore-intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 8, 6, 0.65);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    overflow: hidden;
    padding: 20px;
}

.explore-intro-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.explore-intro-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
    background: linear-gradient(145deg, #1e1912, #2a221a);
    border: 1px solid rgba(201, 169, 110, 0.3);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    transform: scale(0.92) translateY(10px);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.explore-intro-overlay.show .explore-intro-content {
    transform: scale(1) translateY(0);
}

.explore-intro-icon {
    font-size: 64px;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 16px rgba(201, 169, 110, 0.4));
    animation: explore-intro-bob 3s ease-in-out infinite;
}

@keyframes explore-intro-bob {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.explore-intro-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #f5e6d3, #c9a96e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.explore-intro-subtitle {
    font-size: 14px;
    color: rgba(201, 169, 110, 0.7);
    line-height: 1.8;
    margin-bottom: 24px;
}

.explore-intro-rules {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    margin-bottom: 28px;
}

.explore-intro-rule {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: rgba(245, 230, 211, 0.75);
    line-height: 1.5;
}

.explore-intro-rule-icon {
    flex-shrink: 0;
    font-size: 16px;
    margin-top: 1px;
}

.explore-intro-progress {
    background: rgba(201, 169, 110, 0.08);
    border: 1px solid rgba(201, 169, 110, 0.15);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 24px;
}

.explore-intro-progress-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.explore-intro-progress-label {
    font-size: 12px;
    color: rgba(201, 169, 110, 0.6);
}

.explore-intro-progress-value {
    font-size: 18px;
    font-weight: 700;
    color: #c9a96e;
}

.explore-intro-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(201, 169, 110, 0.12);
    border-radius: 3px;
    overflow: hidden;
}

.explore-intro-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c9a96e, #8b6914);
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.explore-intro-progress-note {
    margin-top: 8px;
    color: rgba(245, 230, 211, 0.55);
    font-size: 12px;
    font-weight: 700;
}

.explore-intro-next-actions {
    margin-bottom: 18px;
}

.explore-intro-next-actions:empty {
    display: none;
}

.explore-next-kicker {
    margin-bottom: 8px;
    color: rgba(201, 169, 110, 0.62);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
}

.explore-next-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.explore-next-action {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 14px;
    border-radius: 12px;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.explore-next-action.primary {
    border: 1px solid rgba(201, 169, 110, 0.55);
    background: linear-gradient(135deg, rgba(201, 169, 110, 0.34), rgba(201, 169, 110, 0.14));
    color: #f5e6d3;
}

.explore-next-action.secondary {
    border: 1px solid rgba(201, 169, 110, 0.24);
    background: rgba(30, 25, 18, 0.55);
    color: rgba(245, 230, 211, 0.78);
}

.explore-intro-start-btn {
    width: 100%;
    padding: 16px;
    border: 1px solid rgba(201, 169, 110, 0.5);
    border-radius: 16px;
    font-size: 17px;
    font-weight: 700;
    font-family: 'Noto Sans JP', sans-serif;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(201, 169, 110, 0.3), rgba(201, 169, 110, 0.1));
    color: #f5e6d3;
    box-shadow: 0 4px 20px rgba(201, 169, 110, 0.15);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.explore-intro-start-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(201, 169, 110, 0.25), transparent);
    transform: translateX(-100%);
    animation: explore-btn-shimmer 3s infinite;
}

@keyframes explore-btn-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.explore-intro-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(201, 169, 110, 0.25);
    background: linear-gradient(135deg, rgba(201, 169, 110, 0.4), rgba(201, 169, 110, 0.15));
}

.explore-intro-start-btn:active {
    transform: translateY(0);
}

.explore-intro-back {
    display: inline-block;
    margin-top: 16px;
    font-size: 12px;
    opacity: 0.4;
    color: #f5e6d3;
    text-decoration: none;
    transition: opacity 0.2s;
}

.explore-intro-back:hover {
    opacity: 0.8;
}

@media (max-width: 600px) {
    .explore-intro-title {
        font-size: 24px;
    }
    .explore-intro-icon {
        font-size: 52px;
    }
    .explore-intro-start-btn {
        font-size: 15px;
        padding: 14px;
    }
}

/* 拡大モーダル */
.img-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 8, 6, 0.9);
    cursor: pointer;
}

.img-modal.show {
    display: flex;
}

.img-modal img {
    max-width: 92%;
    max-height: min(
        85vh,
        calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px)
    );
    object-fit: contain;
    border-radius: 8px;
}

/* トースト */
.toast {
    position: fixed;
    top: max(55px, calc(env(safe-area-inset-top) + 44px));
    left: 50%;
    transform: translateX(-50%) translateY(-16px);
    z-index: 70;
    padding: 10px 20px;
    border-radius: 10px;
    background: rgba(30, 25, 18, 0.9);
    border: 1px solid rgba(201, 169, 110, 0.3);
    color: #f5e6d3;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 発見ピンマーカー */
.found-pin {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.found-pin-dot {
    width: 16px;
    height: 16px;
    background: #c9a96e;
    border: 2.5px solid #fff;
    border-radius: 50%;
    box-shadow:
        0 0 12px rgba(201, 169, 110, 0.5),
        0 2px 6px rgba(0, 0, 0, 0.4);
    animation: pinDrop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pinDrop {
    from {
        transform: scale(0) translateY(-20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.found-pin-name {
    margin-top: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #f5e6d3;
    text-shadow:
        0 1px 4px rgba(0, 0, 0, 0.8),
        0 0 8px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 600px) {
    .challenge-thumb {
        width: 64px;
        height: 80px;
    }

    .challenge-q {
        font-size: 13px;
    }

    .disc-card {
        width: 95%;
        max-width: 400px;
        max-height: min(
            90vh,
            calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px)
        );
    }
}

@media (min-width: 601px) {
    .disc-card {
        width: 80vw;
        max-width: none;
        max-height: 80vh;
        display: flex;
        flex-direction: row;
    }

    .disc-img {
        flex: 1;
        min-width: 0;
        max-height: none;
        aspect-ratio: auto;
        border-radius: 18px 0 0 18px;
    }

    .disc-img img {
        height: 100%;
        max-height: 85vh;
    }

    .disc-body {
        width: 350px;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow: hidden;
    }

    .disc-story {
        flex: 1;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
    }
}
