/* 全画面表示のための設定 */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
    touch-action: manipulation;
}

:root {
    --controls-bottom-offset: 84px;
    --controls-stack-height: 56px;
    --controls-stack-clearance: 12px;
    --theme-primary: #00afcc;
    --theme-primary-hover: #0093ab;
    --theme-primary-soft: rgba(0, 175, 204, 0.18);
    --theme-primary-soft-light: rgba(0, 175, 204, 0.12);
    --theme-primary-surface: rgba(240, 252, 254, 0.95);
    --theme-primary-surface-strong: rgba(224, 248, 252, 0.98);
    --theme-text-main: #0f4f5d;
    --theme-text-muted: #5b8d97;
    --theme-accent-red: #ff5a6b;
}

/* 地図の大きさを指定（これが無いと表示されません） */
#map {
    width: 100%;
    height: 100vh; /* 画面いっぱいの高さ */
    z-index: 1;
}

#app-header {
    position: absolute;
    top: 14px;
    left: 0;
    z-index: 1000;
    max-width: min(320px, calc(100vw - 56px));
    transition: transform 0.24s ease;
}

#app-header-toggle {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-height: 64px;
    padding: 12px 56px 12px 14px;
    border: none;
    border-radius: 0 18px 18px 0;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(8px);
    color: var(--theme-text-main);
    cursor: pointer;
    touch-action: manipulation;
    transition: padding 0.24s ease, gap 0.24s ease, border-radius 0.24s ease;
}

.app-header-help-button {
    position: absolute;
    top: 16px;
    right: 14px;
    z-index: 1001;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(8px);
    color: var(--theme-primary);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.app-header-help-button:hover,
.app-header-help-button:focus-visible {
    background: rgba(240, 252, 254, 0.98);
    color: var(--theme-primary-hover);
    transform: translateY(-1px);
}

.fullscreen-toggle-button {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 1002;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(8px);
    color: var(--theme-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.fullscreen-toggle-button:hover,
.fullscreen-toggle-button:focus-visible {
    background: rgba(240, 252, 254, 0.98);
    color: var(--theme-primary-hover);
    transform: translateY(-1px);
}

.fullscreen-toggle-icon {
    position: relative;
    width: 16px;
    height: 16px;
    display: block;
}

.fullscreen-toggle-icon::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(currentColor, currentColor) left top / 6px 2px no-repeat,
        linear-gradient(currentColor, currentColor) left top / 2px 6px no-repeat,
        linear-gradient(currentColor, currentColor) right top / 6px 2px no-repeat,
        linear-gradient(currentColor, currentColor) right top / 2px 6px no-repeat,
        linear-gradient(currentColor, currentColor) left bottom / 6px 2px no-repeat,
        linear-gradient(currentColor, currentColor) left bottom / 2px 6px no-repeat,
        linear-gradient(currentColor, currentColor) right bottom / 6px 2px no-repeat,
        linear-gradient(currentColor, currentColor) right bottom / 2px 6px no-repeat;
    transition: inset 0.2s ease, background-size 0.2s ease;
}

.fullscreen-toggle-button.is-active .fullscreen-toggle-icon::before {
    inset: 2px;
    background:
        linear-gradient(currentColor, currentColor) left top / 4px 2px no-repeat,
        linear-gradient(currentColor, currentColor) left top / 2px 4px no-repeat,
        linear-gradient(currentColor, currentColor) right top / 4px 2px no-repeat,
        linear-gradient(currentColor, currentColor) right top / 2px 4px no-repeat,
        linear-gradient(currentColor, currentColor) left bottom / 4px 2px no-repeat,
        linear-gradient(currentColor, currentColor) left bottom / 2px 4px no-repeat,
        linear-gradient(currentColor, currentColor) right bottom / 4px 2px no-repeat,
        linear-gradient(currentColor, currentColor) right bottom / 2px 4px no-repeat;
}

.app-header-main-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
}

.app-header-logo-wrap {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-self: flex-start;
}

.app-header-logo {
    width: 39px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
    display: block;
}

.app-header-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    overflow: hidden;
    transition: max-width 0.24s ease, opacity 0.2s ease, transform 0.24s ease;
}

.app-header-default-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.app-header-announcements {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0;
    padding: 0 0 0 50px;
    max-height: 0;
    opacity: 0;
    overflow-x: hidden;
    overflow-y: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition:
        max-height 0.24s ease 0s,
        opacity 0.18s ease 0s,
        transform 0.24s ease 0s,
        margin-top 0.24s ease 0s,
        padding-bottom 0.24s ease 0s;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 175, 204, 0.28) transparent;
}

.app-header-announcements::-webkit-scrollbar {
    width: 6px;
}

.app-header-announcements::-webkit-scrollbar-track {
    background: transparent;
}

.app-header-announcements::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(0, 175, 204, 0.28);
}

.app-header-announcements::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 175, 204, 0.4);
}

.app-header-announcements-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 6px;
    padding: 10px 0 2px;
}

.app-header-announcements-heading {
    display: block;
    color: var(--theme-text-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
}

.app-header-announcement-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    text-align: left;
}

.app-header-announcement-date {
    color: var(--theme-text-muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
    color:#a8a8a8;
}

.app-header-announcement-content {
    color: var(--theme-text-main);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
}

.app-header-notice-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--theme-accent-red);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.app-header-title {
    color: var(--theme-text-main);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: nowrap;
}

.app-header-subtitle {
    margin-top: 2px;
    color: var(--theme-text-muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.app-header-subtitle a {
    color: var(--theme-primary);
    text-decoration: none;
}

.app-header-subtitle a:hover,
.app-header-subtitle a:focus-visible {
    color: var(--theme-primary-hover);
    text-decoration: underline;
}

#app-header.collapsed {
    transform: translateX(0);
}

#app-header.collapsed #app-header-toggle {
    padding-right: 14px;
}

#app-header.collapsed .app-header-help-button {
    display: none;
}

body.app-map-fullscreen #app-header,
body.app-map-fullscreen .app-header-help-button,
body.app-map-fullscreen #controls,
body.app-map-fullscreen #layer-panel,
body.app-map-fullscreen .new-layer-notice,
body.app-map-fullscreen .welcome-popup,
body.app-map-fullscreen .info-popup,
body.app-map-fullscreen .tutorial-overlay {
    display: none;
}

#app-header.collapsed .app-header-copy {
    max-width: 0;
    opacity: 0;
    transform: translateX(-8px);
}

#app-header:not(.collapsed) .app-header-copy {
    max-width: 220px;
    opacity: 1;
    transform: translateX(0);
}

#app-header[data-mode="notices"]:not(.collapsed) .app-header-announcements {
    margin-top: 6px;
    max-height: 220px;
    opacity: 1;
    pointer-events: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateY(0);
    transition-delay: 0.18s, 0.18s, 0.18s, 0.18s, 0.18s;
}

#app-header.collapsed .app-header-announcements,
#app-header:not(.collapsed) .app-header-notice-badge,
#app-header:not([data-has-unread="true"]) .app-header-notice-badge {
    display: none;
}

/* 操作パネルを地図の上に浮かせる */
#controls {
    position: absolute;
    bottom: var(--controls-bottom-offset);
    right: 10px;
    z-index: 1000; /* 地図より前面に */
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: bottom 0.28s ease;
}

#controls button {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    color: var(--theme-text-main);
    transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

#controls button:hover,
#controls button:focus-visible {
    background: rgba(240, 252, 254, 0.98);
    color: var(--theme-primary-hover);
    transform: translateY(-1px);
}

#controls button:disabled {
    cursor: default;
    opacity: 0.72;
    transform: none;
}

#north-up-button {
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

#zoom-in-button,
#zoom-out-button {
    font-size: 28px;
    font-weight: 500;
    line-height: 1;
}

#north-up-button.is-active {
    background: var(--theme-primary);
    color: #fff;
}

#layer-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-sizing: border-box;
    padding: 0 10px;
    pointer-events: none;
}

.layer-panel-inner {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 175, 204, 0.12);
    border-bottom: none;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -14px 32px rgba(0, 0, 0, 0.14);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
    overscroll-behavior: contain;
    transform-origin: bottom center;
    transition: box-shadow 0.28s ease, border-radius 0.28s ease;
}

#layer-panel-toggle {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 12px;
    border: none;
    background: transparent;
    color: var(--theme-text-main);
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.layer-panel-toggle-visual {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    margin-bottom: -4px;
}

.layer-panel-grip {
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: rgba(0, 175, 204, 0.24);
}

.layer-panel-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.layer-panel-icon {
    position: relative;
    width: 18px;
    height: 12px;
    border: 1.5px solid var(--theme-primary);
    border-radius: 3px;
    background: var(--theme-primary-soft);
    box-sizing: border-box;
}

.layer-panel-icon::before,
.layer-panel-icon::after {
    content: "";
    position: absolute;
    left: 2px;
    width: 100%;
    height: 100%;
    border: 1.5px solid var(--theme-primary);
    border-radius: 3px;
    background: var(--theme-primary-soft-light);
    box-sizing: border-box;
}

.layer-panel-icon::before {
    top: -4px;
}

.layer-panel-icon::after {
    top: -7px;
}

.layer-panel-chevron {
    width: 8px;
    height: 8px;
    border-right: 1.5px solid var(--theme-primary);
    border-bottom: 1.5px solid var(--theme-primary);
    transform: translateY(1px) rotate(-135deg);
    transition: transform 0.2s ease;
    display: none;
}

#layer-panel:not(.collapsed) .layer-panel-chevron {
    transform: translateY(-1px) rotate(45deg);
}

#layer-panel-summary {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 12px 10px 12px;
    box-sizing: border-box;
}

#layer-panel.collapsed #layer-panel-summary {
    max-height: min(148px, 24vh);
    overflow-y: auto;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

.layer-panel-summary-empty {
    color: var(--theme-text-muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
}

.layer-panel-summary-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(96px, 1fr);
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 10px;
}

.layer-panel-summary-item-base {
    background: var(--theme-primary-surface-strong);
}

.layer-panel-summary-year {
    color: var(--theme-text-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.layer-panel-summary-name {
    min-width: 0;
    color: var(--theme-text-main);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-panel-summary-name-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    border: none;
    padding: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.layer-panel-summary-name-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-panel-summary-switch-icon {
    flex: 0 0 auto;
    color: var(--theme-primary);
    font-size: 12px;
    line-height: 1;
}

.layer-panel-summary-slider {
    width: 100%;
}

#layer-panel-content {
    max-height: min(320px, calc(50vh - 64px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 15px calc(15px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transition:
        max-height 0.28s ease,
        opacity 0.18s ease,
        padding 0.28s ease,
        visibility 0s linear;
}

#layer-panel-content.hidden {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    padding-top: 0;
    padding-bottom: 0;
    transition:
        max-height 0.24s ease,
        opacity 0.12s ease,
        padding 0.24s ease,
        visibility 0s linear 0.24s;
}

#layer-panel.collapsed .layer-panel-inner {
    box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.12);
}

#layer-panel:not(.collapsed) .layer-panel-inner {
    box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.16);
}

h3 { font-size: 12px; border-bottom: none; padding-bottom: 5px; color: var(--theme-text-main); }

.layer-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.layer-panel-heading-main {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.layer-panel-heading h3 {
    flex: 0 0 auto;
    margin: 0;
    padding-bottom: 0;
}

.layer-select-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid rgba(48, 48, 48, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: rgba(79, 79, 79, 0.88);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.layer-select-all input {
    margin: 0;
    width: 14px;
    height: 14px;
    accent-color: var(--theme-primary);
}
.layer-select-all span {
    margin: 0;
    line-height: 1;
}

#layer-tabs {
    display: flex;
    min-width: 0;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

#layer-tabs::-webkit-scrollbar {
    display: none;
}

.layer-tab-button {
    flex: 0 0 auto;
    padding: 7px 12px;
    border: 1px solid rgba(0, 175, 204, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--theme-text-muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
}

.layer-tab-button.is-active {
    border-color: transparent;
    background: var(--theme-primary);
    color: #fff;
}

#layer-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

#layer-list.layer-list-timeline {
    position: relative;
    padding-left: 58px;
}

#layer-list.layer-list-timeline::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 28px;
    width: 2px;
    background: linear-gradient(
        to bottom,
        rgba(0, 175, 204, 0.12),
        rgba(0, 175, 204, 0.42),
        rgba(0, 175, 204, 0.12)
    );
}

.layer-list-empty {
    padding: 12px 14px;
    border: 1px dashed rgba(0, 175, 204, 0.2);
    border-radius: 10px;
    color: var(--theme-text-muted);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

.layer-item {
    position: relative;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(48, 48, 48, 0.12);
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
}

#layer-list.layer-list-timeline .layer-item::before {
    content: "";
    position: absolute;
    top: 17px;
    left: -35px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--theme-primary);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95);
}

#layer-list.layer-list-timeline .layer-item::after {
    content: attr(data-timeline-year);
    position: absolute;
    top: 3px;
    left: -52px;
    width: 44px;
    color: rgba(75, 85, 99, 0.9);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

#layer-list.layer-list-plain .layer-item::before,
#layer-list.layer-list-plain .layer-item::after {
    content: none;
}

.layer-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 0; }
.layer-toggle-label { display: flex; align-items: center; margin-top: 1px; }
.layer-title-row {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.layer-name-button {
    flex: 1;
    margin-left: 0px;
    padding: 0;
    color: rgba(79, 79, 79, 0.88);
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}
.layer-item:hover .layer-name-button { color: rgba(17, 24, 39, 1); }
.layer-year {
    display: none;
    color: rgba(75, 85, 99, 0.9);
    font-size: 12px;
    font-weight: bold;
    line-height: 1.2;
}

#layer-list.layer-list-plain .layer-year {
    display: none;
}

.layer-name {
    font-size: 13px;
    font-weight: bold;
    line-height: 1.5;
}

.layer-info-button {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border: 1px solid rgba(48, 48, 48, 0.18);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    color: rgba(134, 134, 134, 0.88);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
}

.layer-info-button:hover {
    color: var(--theme-primary);
    border-color: rgba(0, 175, 204, 0.28);
}

.new-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    margin-bottom: 2px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--theme-accent-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
    vertical-align: middle;
}
.gps-icon {
    position: relative;
    width: 22px;
    height: 22px;
    border: 2px solid var(--theme-primary);
    border-radius: 50%;
    box-sizing: border-box;
    background: radial-gradient(circle, var(--theme-primary) 0 3px, transparent 3px);
}

.gps-icon::before,
.gps-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    background: var(--theme-primary);
    transform: translate(-50%, -50%);
}

.gps-icon::before {
    width: 2px;
    height: 30px;
}

.gps-icon::after {
    width: 30px;
    height: 2px;
}

.hidden { display: none; }

.new-layer-notice {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(var(--controls-bottom-offset) + var(--controls-stack-height) + var(--controls-stack-clearance));
    transform: translateY(8px);
    z-index: 1100;
    padding: 10px 14px;
    border: none;
    border-radius: 999px;
    background: rgba(63, 63, 63, 0.92);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    cursor: pointer;
    touch-action: manipulation;
    white-space: normal;
    text-align: center;
    line-break: strict;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease, transform 0.6s ease, bottom 0.28s ease;
}

.new-layer-notice.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 0.22s ease, transform 0.22s ease, bottom 0.28s ease;
}

.new-layer-notice.no-transition {
    transition: none;
}

.welcome-popup {
    position: fixed;
    inset: 0;
    z-index: 2100;
}

.welcome-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
}

.welcome-popup-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(92vw, 640px);
    max-height: 82vh;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.welcome-popup-content {
    padding: 22px 20px calc(40px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    color: var(--theme-text-main);
    line-height: 1.7;
}

.welcome-popup-title {
    margin: 0 32px 14px 0;
    font-size: 22px;
    line-height: 1.35;
    color: var(--theme-text-main);
}

.welcome-popup-heading {
    margin: 18px 0 8px;
    font-size: 16px;
    line-height: 1.4;
    color: var(--theme-text-main);
    border-bottom: none;
    padding-bottom: 0;
}

.welcome-popup-content p {
    margin: 0 0 12px;
    font-size: 14px;
}

.welcome-popup-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: rgba(79, 79, 79, 0.88);
}

.welcome-popup-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    width: 100%;
    padding: 11px 18px;
    border: none;
    border-radius: 999px;
    background: var(--theme-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.welcome-popup-secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    width: 100%;
    padding: 11px 18px;
    border: 1px solid rgba(0, 175, 204, 0.28);
    border-radius: 999px;
    background: rgba(240, 252, 254, 0.96);
    color: var(--theme-primary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 2200;
}

.tutorial-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 18, 24, 0.42);
}

.tutorial-overlay-cards {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.tutorial-card {
    position: fixed;
    max-width: min(280px, calc(100vw - 24px));
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    color: var(--theme-text-main);
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
    pointer-events: auto;
}

.tutorial-card-progress {
    display: inline-flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(240, 252, 254, 0.96);
    color: var(--theme-primary);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
}

.tutorial-card-body {
    margin-bottom: 10px;
}

.tutorial-card-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.tutorial-card-button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}

.tutorial-card-button:disabled {
    cursor: default;
    opacity: 0.5;
}

.tutorial-card-button-primary {
    background: var(--theme-primary);
    color: #fff;
}

.tutorial-card-button-secondary {
    background: rgba(240, 252, 254, 0.96);
    color: var(--theme-primary);
}

.tutorial-card::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.98);
    transform: rotate(45deg);
}

.tutorial-card[data-placement="top"]::after {
    left: calc(50% - 6px);
    bottom: -6px;
}

.tutorial-card[data-placement="bottom"]::after {
    left: calc(50% - 6px);
    top: -6px;
}

.tutorial-card[data-placement="left"]::after {
    top: calc(50% - 6px);
    right: -6px;
}

.tutorial-card[data-placement="right"]::after {
    top: calc(50% - 6px);
    left: -6px;
}

.tutorial-overlay-close {
    position: fixed;
    top: 16px;
    right: 16px;
    padding: 10px 14px;
    border: none;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.88);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
    cursor: pointer;
    touch-action: manipulation;
}

.tutorial-highlight-target {
    position: relative;
    z-index: 2201;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.98), 0 0 0 6px rgba(0, 175, 204, 0.34);
}

.info-popup {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.info-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

.info-popup-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(90vw, 420px);
    max-height: 70vh;
    overflow-y: auto;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.info-popup-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: none;
    background: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.info-popup-title {
    margin: 0 28px 10px 0;
    font-size: 16px;
    color: var(--theme-text-main);
}

.info-popup-body {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--theme-text-main);
}

@media (min-width: 900px) {
    #layer-panel {
        left: 50%;
        right: auto;
        width: min(600px, calc(100vw - 24px));
        padding: 0;
        transform: translateX(-50%);
    }

    .new-layer-notice {
        left: 50%;
        right: auto;
        width: min(600px, calc(100vw - 24px));
        transform: translateX(-50%) translateY(8px);
    }

    .new-layer-notice.is-visible {
        transform: translateX(-50%) translateY(0);
    }
}