:root {
    --primary: #ff5722;
    --secondary: #4caf50;
    --warning: #ffc107;
    --danger: #f44336;
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --text-main: #ffffff;
    --text-dim: #b0b0b0;
    --glass: rgba(255, 255, 255, 0.05);
    --page-max-width: 500px;
    --nav-height: 76px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 500px;
    max-width: var(--page-max-width);
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

header {
    padding: calc(20px + var(--safe-top)) 20px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border-bottom: 1px solid var(--glass);
    position: sticky;
    top: 0;
    z-index: 100;
}

h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(45deg, var(--primary), #ff9100);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.profile-icon,
.back-link {
    color: var(--text-main);
    text-decoration: none;
    font-size: 1.35rem;
    line-height: 1;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.profile-icon:active,
.back-link:active {
    background: var(--glass);
}

.header-spacer {
    width: 36px;
    height: 36px;
}

.card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    margin: 15px;
    border: 1px solid var(--glass);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #ff7043);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: block;
    text-align: center;
}

.login-main {
    padding: clamp(18px, 4dvh, 30px) 15px calc(var(--nav-height) + var(--safe-bottom) + 24px);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-label {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 700;
}

.text-input {
    width: 100%;
    padding: 14px 12px;
    border-radius: 8px;
    background: #171717;
    color: var(--text-main);
    border: 1px solid var(--glass);
    font-size: 1rem;
}

.text-input:focus {
    border-color: var(--primary);
    outline: none;
}

.login-message {
    margin: 4px 0;
}

.auth-switch {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
}

.login-divider {
    align-items: center;
    color: var(--text-dim);
    display: flex;
    font-size: 0.85rem;
    font-weight: 700;
    gap: 12px;
    margin: 4px 0;
    text-align: center;
}

.login-divider::before,
.login-divider::after {
    background: var(--glass);
    content: "";
    flex: 1;
    height: 1px;
}

.google-login-button {
    display: flex;
    justify-content: center;
    min-height: 44px;
    width: 100%;
}

.btn-primary:disabled {
    cursor: wait;
    opacity: 0.65;
}

.btn-primary.disabled {
    pointer-events: none;
    opacity: 0.55;
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--primary);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn-secondary:disabled {
    cursor: wait;
    opacity: 0.65;
}

.home-board-link {
    display: block;
    margin-top: 12px;
    text-align: center;
    text-decoration: none;
}

.home-settings-page {
    background: #0f0f0f;
}

.home-settings-shell {
    background:
        linear-gradient(rgba(10, 10, 10, 0.86), rgba(10, 10, 10, 0.92)),
        radial-gradient(circle at 22% 8%, rgba(76, 175, 80, 0.22), transparent 28%),
        linear-gradient(180deg, #202020 0%, #111 100%);
}

.home-settings-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 52px;
    gap: 10px;
    min-height: 60px;
    padding: calc(10px + var(--safe-top)) 14px 8px;
    background: rgba(20, 20, 20, 0.96);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.home-settings-header h1 {
    flex: 1 1 auto;
    margin: 0 10px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #050505;
    color: #fff;
    -webkit-text-fill-color: currentColor;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0;
}

.home-back-button {
    flex: 0 0 72px;
    width: 72px;
    min-height: 40px;
    border: 0;
    border-radius: 0;
    background: #10205a;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

.home-header-spacer {
    flex: 0 0 72px;
    width: 72px;
    min-height: 40px;
}

.home-power-button {
    width: 40px;
    height: 40px;
    background: #222;
    border-color: transparent;
}

.home-settings-header form {
    flex: 0 0 52px;
    width: 52px;
    display: flex;
    justify-content: flex-end;
}

@supports (display: grid) {
    .home-settings-header h1 {
        flex: initial;
        margin: 0;
    }

    .home-back-button,
    .home-header-spacer,
    .home-settings-header form {
        flex: initial;
        width: auto;
    }
}

.home-settings-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px 14px calc(var(--nav-height) + var(--safe-bottom) + 8px);
}

.home-settings-form {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0;
}

.home-settings-main.home-settings-main {
    margin: 0;
}

.home-setting-card {
    min-height: 56px;
    display: grid;
    grid-template-columns: minmax(112px, 0.72fr) minmax(150px, 1fr);
    align-items: center;
    gap: 10px;
    padding: 6px 16px;
    background: rgba(38, 38, 38, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
}

.home-setting-card label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0 0 0 10px;
    background: transparent;
    color: #fff;
    font-size: 1.18rem;
    font-weight: 800;
    line-height: 1.2;
    word-break: keep-all;
}

.home-setting-card label span {
    width: 100%;
}

.home-setting-helper {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
}

.home-setting-input {
    width: 100%;
    min-height: 34px;
    padding: 5px 12px;
    border: 1px solid #fff;
    border-radius: 0;
    background: #050505;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    color-scheme: dark;
}

.home-setting-input::placeholder {
    color: rgba(255, 255, 255, 0.42);
}

.home-setting-input:focus {
    border-color: var(--primary);
    outline: none;
}

.home-setting-input:disabled {
    border-color: rgba(255, 255, 255, 0.3);
    background: #171717;
    color: rgba(255, 255, 255, 0.68);
    cursor: not-allowed;
    opacity: 1;
}

.home-confirm-button {
    margin-top: 0;
    min-height: 48px;
    padding-top: 11px;
    padding-bottom: 11px;
}

.account-delete-form {
    display: flex;
    justify-content: center;
    margin: auto 0 8px;
}

.account-delete-button {
    min-height: 36px;
    padding: 7px 14px;
    border: 1px solid rgba(255, 82, 82, 0.7);
    border-radius: 2px;
    background: #101b38;
    color: #ff6b6b;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

.account-delete-button:hover {
    background: #19294d;
}

.account-delete-button:focus-visible {
    outline: 2px solid #ff5252;
    outline-offset: 3px;
}

.home-save-notice {
    margin: 0;
    text-align: center;
    font-weight: 700;
}

.save-complete-modal {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.68);
}

.save-complete-modal[hidden] {
    display: none;
}

.save-complete-dialog {
    width: min(320px, 100%);
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 26px 22px 20px;
    background: #181818;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.42);
    color: #fff;
    text-align: center;
}

.save-complete-dialog strong {
    font-size: 1.12rem;
    font-weight: 800;
}

.save-complete-button {
    min-height: 48px;
}

@media (max-width: 380px) {
    .home-settings-header {
        grid-template-columns: 62px minmax(0, 1fr) 46px;
        padding-right: 10px;
        padding-left: 10px;
    }

    .home-back-button,
    .home-power-button {
        min-height: 40px;
        height: 40px;
    }

    .home-back-button {
        flex-basis: 62px;
        width: 62px;
    }

    .home-header-spacer {
        flex-basis: 62px;
        width: 62px;
    }

    .home-settings-header form {
        flex-basis: 46px;
        width: 46px;
    }

    .home-settings-header h1 {
        min-height: 40px;
        font-size: 1.2rem;
    }

    .home-setting-card {
        grid-template-columns: minmax(86px, 0.64fr) minmax(0, 1fr);
        gap: 8px;
        min-height: 54px;
        padding: 5px 10px;
    }

    .home-setting-input {
        min-height: 33px;
    }

    .home-setting-card label {
        padding-left: 4px;
        font-size: 1.08rem;
    }
}

@media (max-height: 900px) {
    .home-settings-header {
        min-height: 54px;
        padding-top: calc(6px + var(--safe-top));
        padding-bottom: 6px;
    }

    .home-settings-main {
        gap: 4px;
        padding-top: 6px;
    }

    .home-settings-form {
        gap: 4px;
    }

    .home-setting-card {
        min-height: 52px;
        padding-top: 4px;
        padding-bottom: 4px;
    }

    .home-setting-helper {
        margin-top: 1px;
    }

    .home-setting-input {
        min-height: 32px;
        padding-top: 4px;
        padding-bottom: 4px;
    }

    .home-confirm-button {
        min-height: 44px;
        padding-top: 9px;
        padding-bottom: 9px;
    }
}

.icon-button {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass);
    border-radius: 8px;
    background: transparent;
    color: var(--text-main);
    line-height: 1;
    cursor: pointer;
}

.icon-button svg {
    width: 30px;
    height: 30px;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.icon-button:active {
    background: var(--glass);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.stat-item {
    background: var(--glass);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    min-height: 84px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

#map {
    height: clamp(260px, 52dvh, 420px);
    width: 100%;
    border-radius: 8px;
    margin: 15px 0;
}

.nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    max-width: 500px;
    max-width: var(--page-max-width);
    margin: 0 auto;
    min-height: calc(var(--nav-height) + var(--safe-bottom));
    background: rgba(30, 30, 30, 0.8);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    padding: 12px 15px calc(12px + var(--safe-bottom));
    border-top: 1px solid var(--glass);
    box-sizing: border-box;
}

.nav-item {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
}

.nav-item span {
    font-size: 0.8rem;
    line-height: 1.1;
}

.nav-item.active {
    color: var(--primary);
}

.history-item {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid var(--glass);
}

.history-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.history-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.history-type {
    font-weight: 700;
    color: var(--secondary);
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-align: right;
}

.history-board {
    padding: 15px;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 24px);
}

.history-board-row {
    display: block;
    margin-bottom: 12px;
    padding: 16px;
    color: inherit;
    text-decoration: none;
    background: var(--bg-card);
    border: 1px solid var(--glass);
    border-radius: 8px;
}

.history-board-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.history-board-main strong {
    font-size: 1.08rem;
    line-height: 1.3;
}

.history-board-main span {
    color: var(--text-dim);
    font-size: 0.78rem;
    text-align: right;
    white-space: nowrap;
}

.history-board-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.history-board-meta span {
    min-height: 34px;
    padding: 8px 9px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.25;
}

.track-panel {
    padding: 10px 15px;
}

.gps-setup-panel {
    margin: 0 15px 12px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--glass);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gps-setup-panel strong,
.settings-title-row h2 {
    display: block;
    font-size: 1.05rem;
}

.gps-setup-panel span {
    display: block;
    margin-top: 4px;
    color: var(--text-dim);
    font-size: 0.8rem;
    line-height: 1.35;
}

.settings-main {
    padding: 15px;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 24px);
}

.settings-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.gps-settings-notice {
    display: block;
    margin: 14px 0;
}

.gps-readout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.gps-readout-item {
    min-height: 74px;
    padding: 12px;
    background: var(--glass);
    border-radius: 8px;
}

.gps-readout-item span {
    display: block;
    color: var(--text-dim);
    font-size: 0.78rem;
    margin-bottom: 8px;
}

.gps-readout-item strong {
    color: var(--primary);
    font-size: 1rem;
    word-break: break-word;
}

.select-input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--glass);
    font-size: 1rem;
}

.status-pill {
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 9px;
    white-space: nowrap;
}

.status-pill.ready {
    background: rgba(76, 175, 80, 0.16);
    color: var(--secondary);
}

.status-pill.active {
    background: rgba(255, 87, 34, 0.16);
    color: var(--primary);
}

.status-pill.error {
    background: rgba(244, 67, 54, 0.16);
    color: var(--danger);
}

.notice {
    margin: 0 15px 15px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
    border: 1px solid var(--glass);
}

.notice.info {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
}

.notice.warning {
    background: rgba(255, 193, 7, 0.14);
    color: var(--warning);
}

.notice.error {
    background: rgba(244, 67, 54, 0.14);
    color: var(--danger);
}

.tracking-active .app-container {
    padding-bottom: 0;
}

.saving-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.62);
}

.saving-overlay.show {
    display: flex;
}

.saving-dialog {
    width: min(100%, 420px);
    padding: 34px 24px;
    border-radius: 8px;
    background: #fff;
    color: #111;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.45;
}

.light-page {
    background: #fff;
    color: #111;
}

.detail-shell,
.follow-shell {
    background: #fff;
    color: #111;
}

.detail-shell {
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
}

.light-header {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    gap: 8px;
    padding: calc(18px + var(--safe-top)) clamp(14px, 4vw, 20px) 16px;
    background: #fff;
    color: #081033;
    border-bottom: 1px solid #e7e7e7;
}

.light-header h1 {
    min-width: 0;
    justify-self: center;
    background: none;
    color: #111;
    -webkit-text-fill-color: currentColor;
    font-size: clamp(1.25rem, 5.8vw, 1.5rem);
    line-height: 1.15;
    text-align: center;
    overflow-wrap: anywhere;
}

.activity-detail-header {
    grid-template-columns: 36px minmax(0, 1fr) 58px;
    align-items: center;
}

.activity-detail-logo {
    width: 58px;
    min-width: 58px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
}

.activity-detail-logo img {
    width: 42px;
    height: 42px;
    display: block;
    object-fit: contain;
    flex: 0 0 auto;
}

.light-header .back-link,
.light-header .header-spacer {
    width: 36px;
    min-width: 36px;
}

.back-link.dark {
    color: #081033;
}

.detail-map {
    width: 100%;
    min-width: 0;
    height: clamp(210px, 34dvh, 340px);
    flex: 0 0 auto;
}

.detail-map .leaflet-control-container {
    max-width: 100%;
    overflow: hidden;
}

.detail-map .leaflet-control-attribution {
    max-width: calc(100vw - 18px);
    max-width: calc(100dvw - 18px);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.detail-content,
.detail-summary,
.detail-section {
    width: 100%;
    min-width: 0;
}

.detail-content {
    padding: 24px clamp(16px, 5vw, 24px) calc(var(--nav-height) + var(--safe-bottom) + 42px);
}

.detail-summary h2,
.follow-info h2 {
    font-size: clamp(1.35rem, 6vw, 1.8rem);
    line-height: 1.2;
    margin-bottom: 12px;
    overflow-wrap: anywhere;
}

.detail-meta {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    color: #666;
    font-weight: 700;
}

.detail-meta span {
    min-width: 0;
    max-width: 100%;
}

.detail-meta span:first-child {
    background: #eee;
    color: #555;
    padding: 6px 10px;
    border-radius: 8px;
}

.detail-meta span:last-child {
    overflow-wrap: anywhere;
}

.detail-section {
    margin-top: 34px;
    padding-top: 26px;
    border-top: 8px solid #f0f0f0;
}

.detail-section h3 {
    font-size: 1.45rem;
    margin-bottom: 24px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(14px, 5vw, 22px);
}

.metric-grid div {
    min-width: 0;
    min-height: 72px;
}

.metric-grid span {
    display: block;
    color: #777;
    font-weight: 700;
    margin-bottom: 8px;
}

.metric-grid strong {
    display: block;
    color: #111;
    font-size: 1.35rem;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.detail-actions {
    position: fixed;
    left: 50%;
    bottom: calc(16px + var(--safe-bottom));
    transform: translateX(-50%);
    width: min(452px, calc(100% - 32px));
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feature-paused {
    display: none !important;
}

.btn-primary.navy {
    background: #06124a;
}

.light-secondary {
    border-color: transparent;
    color: #06124a;
    background: #fff;
    text-align: center;
    text-decoration: none;
    font-size: 1.05rem;
}

.review-card {
    background: #f7f7f7;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.review-card strong {
    display: block;
    margin-bottom: 8px;
}

.review-card p {
    color: #333;
    line-height: 1.5;
    white-space: pre-wrap;
}

.activity-detail-page,
.activity-detail-page .detail-shell {
    background: #151515;
    color: #fff;
}

.activity-detail-page .activity-detail-header {
    background: #151515;
    color: #fff;
    border-bottom-color: #2d2d2d;
}

.activity-detail-page .activity-detail-header h1 {
    color: var(--primary);
    -webkit-text-fill-color: currentColor;
}

.activity-detail-page .back-link.dark {
    color: #f5f5f5;
}

.activity-detail-page .detail-map {
    height: clamp(320px, 55vh, 620px);
    height: clamp(320px, 55dvh, 620px);
    border-top: 1px solid #2d2d2d;
    border-bottom: 1px solid #2d2d2d;
}

.activity-detail-page .detail-map.public-map-hidden {
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        #181818;
    background-size: 18px 18px;
    color: #aaa;
    text-align: center;
}

.activity-detail-page .detail-content {
    background: #151515;
}

.activity-detail-page .detail-summary h2,
.activity-detail-page .detail-section h3 {
    color: #f7f7f7;
}

.activity-detail-page .detail-meta {
    color: #aaa;
}

.activity-detail-page .detail-meta span:first-child {
    background: #303030;
    color: #ddd;
}

.activity-detail-page .detail-section {
    border-top-color: #202020;
}

.activity-detail-page .activity-metrics {
    margin-top: 20px;
    padding-top: 0;
    border-top: 0;
}

.activity-detail-page .elevation-profile-section {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #303030;
}

.elevation-profile-section h3 {
    margin-bottom: 14px;
    font-size: 1.15rem;
}

.elevation-chart {
    position: relative;
    width: 100%;
    height: clamp(140px, 19vh, 200px);
    height: clamp(140px, 19dvh, 200px);
    overflow: hidden;
    background: #050505;
    border: 1px solid #303030;
}

.elevation-chart svg {
    display: block;
    width: 100%;
    height: 100%;
}

.elevation-grid line {
    stroke: #666;
    stroke-width: 1;
    stroke-dasharray: 3 7;
    vector-effect: non-scaling-stroke;
}

.elevation-area {
    fill: url("#elevation-area-gradient");
    stroke: none;
}

.elevation-line {
    fill: none;
    stroke: #fff200;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.elevation-value {
    position: absolute;
    right: 8px;
    padding: 2px 5px;
    color: #fff;
    background: rgba(0, 0, 0, 0.62);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    pointer-events: none;
}

.elevation-value-max {
    top: 7px;
}

.elevation-value-min {
    bottom: 7px;
}

.elevation-distance-axis {
    display: flex;
    justify-content: space-between;
    padding-top: 6px;
    color: #aaa;
    font-size: 0.8rem;
    font-weight: 700;
}

.activity-detail-page .metric-grid span {
    color: #a8a8a8;
}

.activity-detail-page .metric-grid strong {
    color: #fff;
}

.activity-detail-page .review-card {
    background: #202020;
    border: 1px solid #303030;
}

.activity-detail-page .review-card p {
    color: #c8c8c8;
}

.activity-community {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.activity-community[hidden] {
    display: none;
}

.activity-like-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #454545;
    border-radius: 999px;
    background: #202020;
    color: #f3f3f3;
    font-size: 0.94rem;
    font-weight: 800;
    cursor: pointer;
}

.activity-like-button #activity-like-icon {
    color: #ff6b72;
    font-size: 1.3rem;
    line-height: 1;
}

.activity-like-button.liked {
    border-color: rgba(255, 87, 34, 0.7);
    background: rgba(255, 87, 34, 0.12);
    color: #ff835d;
}

.activity-like-button:disabled {
    opacity: 0.55;
    cursor: wait;
}

.activity-like-total {
    color: #aaa;
    font-size: 0.9rem;
}

.public-follow-section[hidden] {
    display: none;
}

.activity-like-total strong {
    margin-inline-start: 4px;
    color: #fff;
}

.form-page {
    padding: 18px 15px calc(var(--nav-height) + var(--safe-bottom) + 16px);
}

.board-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.board-page {
    padding: 15px;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 24px);
}

.board-toolbar {
    padding: 15px 15px 0;
}

.write-icon {
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 800;
}

.board-table {
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--glass);
    border-radius: 8px;
}

.board-table-row {
    display: grid;
    grid-template-columns: 38px 70px minmax(0, 1fr) 64px 84px;
    gap: 6px;
    align-items: center;
    min-height: 42px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--glass);
    font-size: 0.8rem;
}

.board-table-row:last-child {
    border-bottom: 0;
}

.board-table-head {
    color: var(--text-dim);
    font-size: 0.74rem;
    font-weight: 800;
}

.board-table-row a {
    color: var(--text-main);
    font-weight: 800;
    text-decoration: none;
}

.board-table-row span,
.board-table-row a {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.board-empty {
    padding: 24px 12px;
    color: var(--text-dim);
    text-align: center;
}

.board-card-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 12px;
}

.board-card {
    display: flex;
    min-height: 168px;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    color: inherit;
    text-decoration: none;
    background: var(--bg-card);
    border: 1px solid var(--glass);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.board-card:active,
.board-card:hover {
    transform: translateY(-2px);
    border-color: rgba(76, 175, 80, 0.55);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.board-card-top,
.board-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.board-card-category {
    max-width: 70%;
    padding: 6px 9px;
    overflow: hidden;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: var(--primary);
    border-radius: 8px;
}

.board-card-no,
.board-card-meta {
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 700;
}

.board-card strong {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text-main);
    font-size: 1.05rem;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.board-card p {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.board-card-meta {
    margin-top: auto;
}

.board-card-meta span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.board-loader {
    margin-top: 14px;
    padding: 14px;
    color: var(--text-dim);
    font-size: 0.88rem;
    font-weight: 700;
    text-align: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass);
    border-radius: 8px;
}

.board-loader[data-mode="loading"]::before {
    display: inline-block;
    width: 13px;
    height: 13px;
    margin-right: 8px;
    vertical-align: -2px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    content: "";
    animation: trailgo-spin 0.75s linear infinite;
}

.board-loader[data-mode="error"] {
    color: #ffb4ab;
}

.board-sentinel {
    height: 1px;
}

.activity-table {
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--glass);
    border-radius: 8px;
}

.activity-table-row {
    display: grid;
    grid-template-columns:
        minmax(0, 0.55fr)
        minmax(0, 0.95fr)
        minmax(0, 1.25fr)
        minmax(0, 0.9fr)
        minmax(0, 1fr)
        minmax(0, 1fr)
        minmax(0, 0.85fr);
    gap: 8px;
    align-items: center;
    min-height: 54px;
    padding: 12px 12px;
    border-bottom: 1px solid var(--glass);
    font-size: 0.9rem;
    font-weight: 800;
}

.activity-table-row:last-child {
    border-bottom: 0;
}

.activity-table-head {
    color: var(--text-dim);
    font-size: 0.82rem;
}

.activity-table-row span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-page,
.history-shell {
    background: #151515;
}

.history-page-header {
    display: grid;
    grid-template-columns: 68px 1fr 68px;
    align-items: center;
    min-height: 64px;
    padding: calc(14px + var(--safe-top)) 16px 8px;
    background: #151515;
    border-bottom: 0;
}

.history-page-header h1 {
    justify-self: center;
    color: var(--primary);
    font-size: 1.42rem;
    line-height: 1.2;
    text-align: center;
    background: none;
    -webkit-text-fill-color: currentColor;
}

.history-back-button {
    display: inline-flex;
    min-width: 58px;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    color: #f5f5f5;
    font-size: 0.95rem;
    font-weight: 800;
    text-decoration: none;
    background: #07124a;
    border-radius: 4px;
}

.history-header-spacer {
    width: 58px;
    height: 34px;
}

.history-header-action {
    position: relative;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    border: 1px solid #303030;
    border-radius: 50%;
    background: #202020;
    color: #f5f5f5;
    font-size: 1.2rem;
    line-height: 1;
    text-decoration: none;
}

.history-notification-badge {
    position: absolute;
    top: -5px;
    inset-inline-end: -7px;
    min-width: 19px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #151515;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.63rem;
    font-weight: 900;
}

.history-notification-badge[hidden] {
    display: none;
}

.history-header-action:active {
    background: #303030;
    transform: scale(0.96);
}

.history-main {
    padding: 8px 18px calc(var(--nav-height) + var(--safe-bottom) + 28px);
}

.history-main .card {
    margin: 0;
    background: #202020;
    border-color: #2d2d2d;
}

.history-toolbar {
    display: grid;
    gap: 10px;
    margin-bottom: 8px;
}

.history-distance-filter {
    width: 100%;
    min-height: 40px;
    padding: 7px 28px 7px 10px;
    border: 1px solid #383838;
    border-radius: 7px;
    outline: none;
    background: #202020;
    color: #eee;
    font-size: 0.82rem;
    font-weight: 800;
}

.history-search {
    position: relative;
    display: block;
}

.history-search-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 14px;
    height: 14px;
    border: 2px solid #aaa;
    border-radius: 50%;
    transform: translateY(-58%);
    pointer-events: none;
}

.history-search-icon::after {
    position: absolute;
    right: -5px;
    bottom: -4px;
    width: 7px;
    height: 2px;
    background: #aaa;
    border-radius: 2px;
    content: "";
    transform: rotate(45deg);
    transform-origin: left center;
}

.history-search input {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px 10px 42px;
    border: 1px solid #353535;
    border-radius: 7px;
    outline: none;
    background: #1d1d1d;
    color: #fff;
    font-size: 0.9rem;
}

.history-search input::placeholder {
    color: #858585;
}

.history-search input:focus,
.history-filter-row select:focus,
.history-distance-filter:focus,
.history-summary-row select:focus {
    border-color: var(--primary);
}

.history-filter-row,
.history-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.history-filter-row select,
.history-summary-row select {
    min-height: 34px;
    padding: 6px 28px 6px 12px;
    border: 1px solid #383838;
    border-radius: 18px;
    outline: none;
    background: #202020;
    color: #eee;
    font-size: 0.82rem;
    font-weight: 800;
}

.history-filter-row select {
    flex: 1 1 0;
    min-width: 0;
}

.history-summary-row {
    min-height: 34px;
    padding-top: 2px;
}

.history-summary-row strong {
    color: #f1f1f1;
    font-size: 0.88rem;
}

.history-summary-row select {
    border-color: transparent;
    background-color: transparent;
    color: #bdbdbd;
    font-weight: 700;
}

.history-list-region {
    min-width: 0;
}

.activity-list {
    overflow: hidden;
    border-top: 1px solid #2d2d2d;
}

.activity-list-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 40px;
    align-items: center;
    gap: 12px;
    min-height: 98px;
    padding: 12px 0;
    border-bottom: 1px solid #2d2d2d;
    outline: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.activity-list-row:hover,
.activity-list-row:focus-visible {
    background: rgba(255, 87, 34, 0.055);
}

.activity-list-row:active {
    background: rgba(255, 87, 34, 0.1);
}

.activity-route-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    overflow: hidden;
    background:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        radial-gradient(circle at 50% 45%, #292929 0, #111 72%);
    background-size: 12px 12px, 12px 12px, 100% 100%;
    border: 1px solid #3a3a3a;
    border-radius: 7px;
    box-shadow: inset 0 0 0 999px rgba(5, 5, 5, 0.2);
}

.activity-route-thumb svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

.activity-route-thumb path,
.activity-route-thumb polyline {
    fill: none;
    stroke: #ff5722;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 4;
    vector-effect: non-scaling-stroke;
}

.activity-route-thumb circle {
    stroke: #0b0b0b;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.activity-route-thumb .route-start {
    fill: #fff;
}

.activity-route-thumb .route-end {
    fill: #ff5722;
}

.activity-route-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.58);
    font-size: 1.4rem;
    font-weight: 900;
}

.activity-similarity-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    line-height: 1;
}

.activity-similarity-score strong {
    font-size: 0.92rem;
}

.activity-similarity-score small {
    margin-top: 4px;
    color: #888;
    font-size: 0.62rem;
    font-weight: 700;
    white-space: nowrap;
}

.activity-list-content {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.activity-start-place {
    display: block;
    overflow: hidden;
    color: #f5f5f5;
    font-size: 0.96rem;
    font-weight: 900;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-list-meta,
.activity-list-sub {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    color: #b1b1b1;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
}

.activity-list-meta i {
    color: #5d5d5d;
    font-style: normal;
}

.activity-list-sub em {
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: 3px;
    background: #303030;
    color: #c7c7c7;
    font-size: 0.68rem;
    font-style: normal;
}

.activity-list-sub time {
    min-width: 0;
    overflow: hidden;
    color: #888;
    text-overflow: ellipsis;
}

.history-empty-state {
    text-align: center;
    color: var(--text-dim);
}

.activity-video-button {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 1px solid rgba(255, 87, 34, 0.18);
    border-radius: 7px;
    background: rgba(255, 87, 34, 0.14);
    color: #ff6a2a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.activity-video-button:disabled {
    cursor: wait;
    opacity: 0.55;
}

.activity-video-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.video-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.76);
}

.video-modal[hidden] {
    display: none;
}

.video-modal-panel {
    position: relative;
    width: min(720px, 100%);
    max-height: calc(100dvh - 36px - var(--safe-top) - var(--safe-bottom));
    overflow: auto;
    background: #111;
    border: 1px solid var(--glass);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

.video-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--glass);
}

.video-modal-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 900;
    color: var(--text-main);
}

.trailgo-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff url("/static/img/trailgo-video-logo.png?v=20260707-logo") center / cover no-repeat;
    color: transparent;
    font-size: 0;
    font-weight: 1000;
    letter-spacing: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.14);
}

.video-modal-close {
    width: 38px;
    height: 38px;
    border: 1px solid var(--glass);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}

.video-modal-body {
    padding: 14px;
}

.route-video-player {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 70dvh;
    background: #000;
    border-radius: 8px;
}

.video-modal-status {
    margin-top: 10px;
    color: var(--text-dim);
    font-size: 0.88rem;
    font-weight: 700;
}

.video-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 14px 14px;
}

.video-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(2px);
}

.video-loading-overlay[hidden] {
    display: none;
}

.video-loading-card {
    width: min(300px, 86%);
    min-height: 260px;
    padding: 28px 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(255, 255, 255, 0.96);
    color: #555;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.34);
}

.video-loading-spinner {
    width: 126px;
    height: 126px;
    border-radius: 50%;
    border: 12px solid rgba(90, 90, 90, 0.18);
    border-top-color: #303030;
    border-right-color: #707070;
    animation: trailgo-spin 0.9s linear infinite;
}

.video-loading-card strong {
    margin-top: 28px;
    color: #555;
    font-size: 1.7rem;
    font-weight: 800;
}

.video-loading-card p {
    margin-top: 8px;
    color: #777;
    font-size: 0.95rem;
    line-height: 1.35;
    font-weight: 700;
}

.video-save-button {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--glass);
    border-radius: 8px;
    background: rgba(255, 87, 34, 0.16);
    color: var(--primary);
    font-weight: 900;
    cursor: pointer;
}

.video-save-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.video-save-button.is-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.video-save-button.is-loading::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: trailgo-spin 0.75s linear infinite;
}

@keyframes trailgo-spin {
    to {
        transform: rotate(360deg);
    }
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

.pagination-button {
    min-width: 36px;
    height: 36px;
    border: 1px solid var(--glass);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-main);
    font-weight: 800;
    cursor: pointer;
}

.pagination-button.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.board-post {
    display: block;
    margin-bottom: 12px;
    padding: 16px;
    color: inherit;
    text-decoration: none;
    background: var(--bg-card);
    border: 1px solid var(--glass);
    border-radius: 8px;
}

.board-post-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.board-post-head strong {
    font-size: 1.05rem;
    line-height: 1.3;
}

.board-post-head span {
    color: var(--text-dim);
    font-size: 0.78rem;
    white-space: nowrap;
}

.review-post-head > div {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
}

.review-post-head em {
    color: var(--text-main);
    font-size: 0.92rem;
    font-style: normal;
    font-weight: 800;
}

.board-post p {
    color: var(--text-dim);
    line-height: 1.45;
    margin-bottom: 14px;
    word-break: break-word;
}

.board-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.board-post-meta span {
    padding: 6px 9px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-main);
    font-size: 0.78rem;
    font-weight: 700;
}

.board-detail {
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--glass);
    border-radius: 8px;
}

.board-detail-head {
    margin-bottom: 16px;
}

.board-detail-head h2 {
    margin-bottom: 8px;
    font-size: 1.35rem;
    line-height: 1.35;
}

.board-detail-head span {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.board-post-meta.detail {
    margin-bottom: 20px;
}

.board-detail-content {
    min-height: 180px;
    padding: 16px 0;
    color: var(--text-main);
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    border-top: 1px solid var(--glass);
    border-bottom: 1px solid var(--glass);
}

.board-detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 18px;
}

.board-detail-actions.single {
    grid-template-columns: 1fr;
}

.board-detail-actions .btn-secondary {
    text-align: center;
    text-decoration: none;
}

.text-area {
    width: 100%;
    padding: 14px 12px;
    border-radius: 8px;
    background: #171717;
    color: var(--text-main);
    border: 1px solid var(--glass);
    font-size: 1rem;
    resize: vertical;
    line-height: 1.45;
}

.nav-svg {
    width: 33px;
    height: 33px;
    margin-bottom: 2px;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.calendar-page {
    background: #000;
    color: #f5f5f5;
}

.calendar-shell {
    background: #000;
}

.calendar-header {
    display: grid;
    grid-template-columns: 84px 1fr 84px;
    align-items: center;
    background: #000;
    border-bottom: 0;
    padding: calc(10px + var(--safe-top)) 16px 4px;
    min-height: 54px;
}

.calendar-header-spacer {
    width: 84px;
    height: 36px;
}

.calendar-logo {
    justify-self: center;
    display: inline-flex;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: transparent;
    border-radius: 8px;
}

.calendar-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.calendar-actions {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.calendar-header .icon-button {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
}

.day-topbar strong {
    background: none;
    color: #f5f5f5;
    -webkit-text-fill-color: currentColor;
    font-size: 1.55rem;
    font-weight: 800;
}

.calendar-main {
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 54px);
}

.calendar-view,
.day-view {
    padding: 0;
}

.month-toolbar {
    min-height: 50px;
    padding: 0 22px 4px;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 12px;
}

.month-toolbar strong {
    text-align: center;
    color: #aaa;
    font-size: 1.48rem;
    font-weight: 700;
}

.month-button,
.plain-icon,
.round-nav {
    border: 0;
    background: transparent;
    color: #42a5ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.month-button,
.plain-icon {
    width: 44px;
    height: 44px;
}

.month-button svg,
.plain-icon svg,
.round-nav svg {
    width: 32px;
    height: 32px;
    stroke: currentColor;
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.week-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 0 0 5px;
    color: #aaa;
    font-size: 1.2rem;
    font-weight: 800;
    text-align: center;
}

.calendar-grid {
    display: flex;
    flex-wrap: wrap;
    align-content: stretch;
    margin: -2.5px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, minmax(0, 1fr));
    gap: 5px;
    height: clamp(300px, calc(100vh - 54px - 50px - 32px - 46px - var(--nav-height) - var(--safe-top) - var(--safe-bottom)), 520px);
    height: clamp(300px, calc(100dvh - 54px - 50px - 32px - 46px - var(--nav-height) - var(--safe-top) - var(--safe-bottom)), 520px);
    min-height: 0;
    max-height: none;
}

.calendar-cell {
    position: relative;
    flex: 0 0 calc(14.2857% - 5px);
    width: calc(14.2857% - 5px);
    height: calc(16.6667% - 5px);
    margin: 2.5px;
    min-height: 0;
    padding: 9px 7px 36px;
    border: 2px solid transparent;
    background: #232323;
    color: #e9e9e9;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
}

@supports (display: grid) {
    .calendar-grid {
        margin: 0;
    }

    .calendar-cell {
        width: auto;
        height: auto;
        margin: 0;
    }
}

.calendar-cell.outside {
    color: #858585;
    background: #1a1a1a;
}

.calendar-cell.selected {
    border-color: #3ca2ff;
}

.calendar-cell.today .cell-date {
    color: #fff;
}

.cell-date {
    display: block;
    margin-bottom: 6px;
    font-size: 1.08rem;
    font-weight: 800;
}

.cell-memo {
    display: block;
    max-width: 100%;
    margin-top: 16px;
    overflow: hidden;
    color: #f5f5f5;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-bottom {
    position: absolute;
    right: 7px;
    bottom: 14px;
    left: 7px;
    display: flex;
    align-items: flex-end;
    gap: 5px;
    min-width: 0;
}

.cell-bars {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: flex-end;
    gap: 5px;
}

.cell-bars i {
    display: block;
    width: 100%;
    height: 7px;
}

.cell-bottom strong {
    flex: 0 0 auto;
    color: #52aaff;
    font-size: 1.05rem;
    line-height: 1;
    white-space: nowrap;
}

.day-topbar {
    min-height: 58px;
    padding: 8px 20px 4px;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
}

.day-topbar strong {
    text-align: center;
}

.day-date-row {
    padding: 8px 20px 14px;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
}

.day-date-row h2 {
    text-align: center;
    font-size: 1.55rem;
    font-weight: 500;
}

.round-nav {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #2a2a2a;
    color: #d9d9d9;
}

.round-nav svg {
    width: 22px;
    height: 22px;
}

.day-memo-view {
    margin: 0;
    padding: 22px 28px 20px;
    background: #1f1f1f;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.day-memo-view[hidden] {
    display: none;
}

.day-memo-view strong {
    display: block;
    margin-bottom: 8px;
    color: #fff;
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.25;
    word-break: break-word;
}

.day-memo-view p {
    color: #c9c9c9;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.day-memo-view p[hidden] {
    display: none;
}

.category-list {
    background: #1f1f1f;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
}

.movement-row {
    min-height: 110px;
    padding: 18px 20px;
    display: grid;
    grid-template-columns: 70px 1fr;
    align-items: center;
    gap: 18px;
}

.movement-icon {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    font-weight: 900;
}

.movement-row strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.45rem;
    font-weight: 800;
}

.movement-row p {
    color: #aaa;
    font-size: 1.02rem;
    line-height: 1.35;
}

.empty-day {
    margin: 0 20px;
    padding: 28px 18px;
    border: 1px solid #333;
    border-radius: 8px;
    color: #aaa;
    text-align: center;
}

.chart-floating-button {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 10px);
    z-index: 160;
    width: min(452px, calc(100% - 32px));
    height: 34px;
    margin: 0;
    flex: 0 0 auto;
    transform: translateX(-50%);
    border: 1px solid #42a5ff;
    border-radius: 3px;
    background: #050505;
    color: #42a5ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.chart-floating-button[hidden] {
    display: none;
}

.chart-floating-button svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.memo-top-button svg {
    width: 26px;
    height: 26px;
}

.memo-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.74);
}

.memo-modal[hidden] {
    display: none;
}

.memo-dialog {
    width: min(420px, 100%);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #1e1e1e;
    border: 1px solid var(--glass);
    border-radius: 8px;
}

.memo-dialog strong {
    font-size: 1.1rem;
}

.memo-dialog label span {
    display: block;
    margin-bottom: 7px;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 800;
}

.memo-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.month-chart-view {
    height: calc(100vh - 54px - var(--nav-height) - var(--safe-top) - var(--safe-bottom));
    height: calc(100dvh - 54px - var(--nav-height) - var(--safe-top) - var(--safe-bottom));
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: 0 0 32px;
    background: #000;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.month-chart-view .day-topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 10px 16px 0;
    background: #000;
}

.month-chart-view .day-topbar strong {
    color: #f35a20;
    font-size: clamp(1.18rem, 4.8vw, 1.55rem);
    line-height: 1.2;
    background: none;
    -webkit-text-fill-color: currentColor;
}

.month-chart-wrap {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    padding: 72px 18px 24px;
    padding: clamp(48px, 10dvh, 132px) 18px 24px;
}

.month-chart-bars {
    width: max-content;
    min-width: 100%;
    height: 354px;
    height: clamp(324px, 45dvh, 354px);
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 0;
}

.month-chart-day {
    width: 38px;
    min-width: 38px;
    height: 342px;
    height: clamp(312px, 43dvh, 342px);
    flex: 0 0 38px;
    display: grid;
    grid-template-rows: 30px minmax(250px, 1fr) 22px;
    align-items: end;
    gap: 5px;
}

.month-chart-day:nth-child(1),
.month-chart-day:nth-child(11),
.month-chart-day:nth-child(21) {
    scroll-snap-align: start;
}

.month-chart-value {
    display: block;
    min-width: 100%;
    color: #fff;
    font-size: 0.76rem;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

.month-chart-bar {
    width: 100%;
    height: var(--bar-height, 2px);
    max-height: 100%;
    align-self: end;
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-start;
    overflow: hidden;
    background: #151515;
    border-radius: 3px 3px 0 0;
}

.month-chart-segment {
    display: block;
    min-height: 2px;
}

.month-chart-segment.empty {
    flex: 1;
    background: #272727;
}

.month-chart-day em {
    display: block;
    color: #aaa;
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 800;
    line-height: 1;
    text-align: center;
}

.month-chart-legend {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 22px 8px;
    color: #e4e4e4;
    font-size: 1rem;
    font-weight: 800;
    text-align: left;
}

.month-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 148px;
    min-height: 18px;
}

.month-chart-legend i {
    display: inline-block;
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border-radius: 2px;
}

@media (max-width: 430px) {
    .month-chart-bars {
        gap: 7px;
    }

    .month-chart-value {
        font-size: 0.7rem;
    }

    .month-chart-day em {
        font-size: 0.72rem;
    }

    .activity-table-row {
        grid-template-columns:
            minmax(0, 0.55fr)
            minmax(0, 0.95fr)
            minmax(0, 1.25fr)
            minmax(0, 0.9fr)
            minmax(0, 1fr)
            minmax(0, 1fr)
            minmax(0, 0.9fr);
        gap: 6px;
        min-height: 56px;
        padding: 12px 10px;
        font-size: 0.88rem;
    }

    .activity-table-head {
        font-size: 0.78rem;
    }

    .activity-video-button {
        width: 42px;
        height: 42px;
        border-radius: 6px;
        justify-self: end;
    }

    .activity-video-button svg {
        width: 17px;
        height: 17px;
    }

    .calendar-grid {
        gap: 5px;
        min-height: min(404px, calc(100dvh - 176px - var(--nav-height) - var(--safe-top) - var(--safe-bottom)));
    }

    .calendar-cell {
        padding: 8px 5px 34px;
    }

    .cell-date {
        margin-bottom: 10px;
        font-size: 0.95rem;
    }

    .cell-bottom {
        right: 5px;
        bottom: 12px;
        left: 5px;
    }

    .cell-bars {
        gap: 4px;
    }

    .movement-row {
        grid-template-columns: 58px 1fr;
        gap: 14px;
    }

    .movement-icon {
        width: 52px;
        height: 52px;
    }
}

@media (max-width: 360px) {
    .history-main {
        padding-right: 12px;
        padding-left: 12px;
    }

    .activity-list-row {
        grid-template-columns: 62px minmax(0, 1fr) 36px;
        gap: 9px;
    }

    .activity-route-thumb {
        width: 62px;
        height: 62px;
    }

    .activity-list-meta {
        gap: 4px;
        font-size: 0.7rem;
    }

    .activity-table-row {
        gap: 4px;
        padding: 10px 7px;
        font-size: 0.8rem;
    }

    .activity-table-head {
        font-size: 0.7rem;
    }

    .activity-video-button {
        width: 36px;
        height: 36px;
    }
}

@media (max-height: 700px) {
    header {
        padding-top: calc(14px + var(--safe-top));
        padding-bottom: 14px;
    }

    .card {
        margin: 12px;
        padding: 16px;
    }

    .home-settings-header,
    .history-page-header,
    .calendar-header {
        padding-top: calc(8px + var(--safe-top));
    }

    .home-settings-main {
        gap: 3px;
        padding-top: 4px;
    }

    .home-settings-form {
        gap: 3px;
    }

    .home-setting-card {
        min-height: 48px;
        padding: 3px 12px;
    }

    .home-confirm-button {
        min-height: 42px;
    }

    .calendar-grid {
        height: clamp(300px, calc(100dvh - 56px - 52px - 30px - var(--nav-height) - var(--safe-top) - var(--safe-bottom)), 500px);
        gap: 4px;
        min-height: 300px;
    }

    .calendar-cell {
        padding: 6px 5px 28px;
    }

    .cell-memo {
        margin-top: 8px;
        font-size: 0.72rem;
    }

    .movement-row {
        min-height: 92px;
        padding: 14px 18px;
    }

    .movement-row strong {
        font-size: 1.25rem;
    }

    .movement-row p {
        font-size: 0.92rem;
    }

    .follow-info {
        padding: 22px 20px 28px;
    }

    .complete-sheet {
        padding-top: 28px;
        max-height: calc(100dvh - var(--safe-top) - 18px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .complete-stats {
        margin: 24px 0 16px;
        gap: 14px;
    }
}

.follow-map {
    height: clamp(320px, 58dvh, 620px);
    min-height: 0;
    width: 100%;
}

.follow-info {
    margin-top: -24px;
    position: relative;
    z-index: 10;
    padding: 28px 24px 34px;
    background: #fff;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
}

.follow-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 22px 0 18px;
    color: #081033;
    font-size: 1.05rem;
    font-weight: 800;
}

.follow-address {
    min-height: 42px;
    margin-bottom: 22px;
    color: #555;
    line-height: 1.45;
    word-break: break-word;
}

.complete-shell {
    min-height: 100vh;
    min-height: 100dvh;
    background: #111;
    position: relative;
    overflow: hidden;
}

.complete-map {
    height: clamp(280px, 52dvh, 520px);
    min-height: 0;
    filter: brightness(0.55);
}

.complete-sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(500px, 100%);
    max-height: calc(100dvh - var(--safe-top) - 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 36px 24px calc(34px + var(--safe-bottom));
    background: #fff;
    color: #111;
    border-radius: 8px 8px 0 0;
    text-align: center;
}

.complete-sheet h1 {
    margin-bottom: 10px;
    background: none;
    color: #111;
    -webkit-text-fill-color: currentColor;
    font-size: 1.8rem;
}

.complete-sheet p {
    color: #333;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.45;
}

.complete-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 34px 0 20px;
}

.complete-stats span {
    display: block;
    color: #777;
    font-weight: 800;
    margin-bottom: 8px;
}

.complete-stats strong {
    color: #06124a;
    font-size: 1.45rem;
}

.complete-later {
    display: inline-block;
    margin-top: 22px;
    color: #06124a;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.15rem;
}

.community-page,
.community-shell {
    background: #151515;
}

.community-header {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) 76px;
    align-items: center;
    min-height: 64px;
    padding: calc(12px + var(--safe-top)) 14px 10px;
    border-bottom: 1px solid #292929;
    background: #151515;
}

.community-header h1 {
    justify-self: center;
    color: var(--primary);
    background: none;
    -webkit-text-fill-color: currentColor;
    font-size: 1.35rem;
    text-align: center;
}

.community-back {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #f5f5f5;
    font-size: 1.35rem;
    text-decoration: none;
}

.community-header button {
    min-height: 34px;
    padding: 5px 8px;
    border: 1px solid #3c3c3c;
    border-radius: 7px;
    background: #252525;
    color: #ddd;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
}

.community-header-spacer {
    width: 76px;
    height: 40px;
}

.community-main {
    flex: 1;
    padding: 14px 16px calc(var(--nav-height) + var(--safe-bottom) + 28px);
}

.community-main h2 {
    margin: 6px 2px 12px;
    color: #f5f5f5;
    font-size: 1.05rem;
}

.community-empty {
    padding: 40px 18px;
    border: 1px dashed #363636;
    border-radius: 12px;
    color: #999;
    text-align: center;
}

.notification-list {
    display: grid;
    gap: 8px;
}

.notification-row {
    width: 100%;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 11px;
    padding: 14px 12px;
    border: 1px solid #2e2e2e;
    border-radius: 11px;
    background: #202020;
    color: #fff;
    text-align: start;
    cursor: pointer;
}

.notification-row.unread {
    border-color: rgba(255, 87, 34, 0.45);
    background: linear-gradient(90deg, rgba(255, 87, 34, 0.1), #202020 52%);
}

.notification-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #303030;
    color: #ff7650;
    font-size: 1.2rem;
}

.notification-copy {
    min-width: 0;
}

.notification-copy strong,
.notification-copy time {
    display: block;
}

.notification-copy strong {
    overflow-wrap: anywhere;
    font-size: 0.9rem;
    line-height: 1.42;
}

.notification-copy time {
    margin-top: 5px;
    color: #969696;
    font-size: 0.74rem;
}

.notification-chevron {
    color: #777;
    font-size: 1.4rem;
}

.challenge-main {
    display: grid;
    align-content: start;
    gap: 28px;
}

.challenge-list {
    display: grid;
    gap: 12px;
}

.challenge-card {
    padding: 17px;
    border: 1px solid #303030;
    border-radius: 14px;
    background: #202020;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
}

.challenge-card.completed {
    border-color: rgba(255, 145, 0, 0.55);
    background: linear-gradient(145deg, rgba(255, 145, 0, 0.1), #202020 48%);
}

.challenge-card-heading,
.challenge-card-footer,
.challenge-progress-copy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.challenge-card h3 {
    margin-top: 5px;
    color: #fff;
    font-size: 1.08rem;
}

.challenge-period {
    color: #ff825d;
    font-size: 0.73rem;
    font-weight: 800;
}

.challenge-trophy {
    font-size: 1.75rem;
}

.challenge-card > p {
    margin-top: 10px;
    color: #aaa;
    font-size: 0.84rem;
    line-height: 1.5;
}

.challenge-progress-copy {
    justify-content: flex-start;
    margin-top: 16px;
    color: #929292;
    font-size: 0.82rem;
}

.challenge-progress-copy strong {
    color: #f5f5f5;
    font-size: 1.12rem;
}

.challenge-progress {
    height: 8px;
    margin-top: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #363636;
}

.challenge-progress span {
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #ff9a22);
    transition: width 0.25s ease;
}

.challenge-card-footer {
    margin-top: 12px;
    color: #8e8e8e;
    font-size: 0.73rem;
}

.challenge-reward {
    max-width: 58%;
    overflow: hidden;
    color: #d8b779;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.challenge-join-button {
    width: 100%;
    min-height: 42px;
    margin-top: 15px;
    border: 0;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.challenge-join-button:disabled {
    background: #343434;
    color: #aaa;
    cursor: default;
}

.challenge-join-button.complete:disabled {
    background: rgba(255, 145, 0, 0.2);
    color: #ffbd60;
}

.badge-list {
    display: grid;
    gap: 9px;
}

.badge-card {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 13px;
    border: 1px solid #303030;
    border-radius: 11px;
    background: #202020;
}

.badge-card img,
.badge-medal {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #303030;
    object-fit: cover;
    font-size: 1.7rem;
}

.badge-card strong {
    display: block;
    color: #f5f5f5;
    font-size: 0.9rem;
}

.badge-card p {
    margin-top: 3px;
    color: #999;
    font-size: 0.75rem;
    line-height: 1.4;
}

.badge-card time {
    display: block;
    margin-top: 5px;
    color: #ff825d;
    font-size: 0.7rem;
}

@media (max-width: 380px) {
    header {
        padding: 16px 14px;
    }

    .stats-grid {
        gap: 10px;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .metric-grid strong {
        font-size: 1.1rem;
    }

    .follow-map {
        height: clamp(300px, 56dvh, 520px);
        min-height: 0;
    }
}

@media (max-width: 430px) {
    .light-header {
        grid-template-columns: 34px minmax(0, 1fr) 34px;
        padding: calc(16px + var(--safe-top)) 14px 14px;
    }

    .activity-detail-header {
        grid-template-columns: 34px minmax(0, 1fr) 52px;
    }

    .activity-detail-logo {
        width: 52px;
        min-width: 52px;
        height: 38px;
    }

    .activity-detail-logo img {
        width: 38px;
        height: 38px;
    }

    .light-header .back-link,
    .light-header .header-spacer {
        width: 34px;
        min-width: 34px;
    }

    .detail-map {
        height: clamp(198px, 32dvh, 300px);
    }

    .detail-content {
        padding: 22px 16px calc(var(--nav-height) + var(--safe-bottom) + 44px);
    }

    .detail-section {
        margin-top: 30px;
        padding-top: 22px;
    }

    .detail-section h3 {
        margin-bottom: 20px;
    }

    .detail-content .metric-grid.six {
        gap: 18px 12px;
    }
}

@media (max-width: 380px) {
    .detail-content .metric-grid.six {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px 10px;
    }

    .detail-content .metric-grid span {
        font-size: 0.82rem;
    }

    .detail-content .metric-grid strong {
        font-size: clamp(0.96rem, 4.8vw, 1.1rem);
    }
}

@media (max-width: 330px) {
    .detail-content .metric-grid.six {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 500px) and (min-aspect-ratio: 9 / 16) {
    .detail-map {
        height: clamp(180px, 28dvh, 260px);
    }

    .detail-content {
        padding-top: 20px;
    }
}

@media (max-width: 430px) {
    .calendar-header {
        grid-template-columns: 72px minmax(0, 1fr) 72px;
        padding: calc(8px + var(--safe-top)) 14px 2px;
        min-height: 50px;
    }

    .calendar-header-spacer {
        width: 72px;
        height: 34px;
    }

    .calendar-logo {
        width: 42px;
        height: 42px;
    }

    .calendar-actions {
        gap: 6px;
    }

    .calendar-header .icon-button {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
    }

    .month-toolbar {
        min-height: 46px;
        padding: 0 18px 2px;
    }

    .month-toolbar strong {
        font-size: 1.34rem;
    }

    .week-row {
        padding-bottom: 4px;
        font-size: 1rem;
    }

    .calendar-grid {
        height: clamp(290px, calc(100vh - 50px - 46px - 28px - 46px - var(--nav-height) - var(--safe-top) - var(--safe-bottom)), 470px);
        height: clamp(290px, calc(100dvh - 50px - 46px - 28px - 46px - var(--nav-height) - var(--safe-top) - var(--safe-bottom)), 470px);
        min-height: 0;
    }

    .chart-floating-button {
        bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
        width: min(452px, calc(100% - 40px));
    }
}

@media (max-height: 700px) {
    .calendar-header {
        padding-top: calc(6px + var(--safe-top));
        padding-bottom: 2px;
        min-height: 46px;
    }

    .calendar-logo {
        width: 40px;
        height: 40px;
    }

    .calendar-header .icon-button {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
    }

    .month-toolbar {
        min-height: 40px;
        padding-bottom: 0;
    }

    .month-button,
    .plain-icon {
        width: 38px;
        height: 38px;
    }

    .month-button svg,
    .plain-icon svg {
        width: 28px;
        height: 28px;
    }

    .month-toolbar strong {
        font-size: 1.24rem;
    }

    .week-row {
        padding-bottom: 3px;
        font-size: 0.95rem;
    }

    .calendar-grid {
        height: clamp(270px, calc(100vh - 46px - 40px - 26px - 44px - var(--nav-height) - var(--safe-top) - var(--safe-bottom)), 390px);
        height: clamp(270px, calc(100dvh - 46px - 40px - 26px - 44px - var(--nav-height) - var(--safe-top) - var(--safe-bottom)), 390px);
        min-height: 0;
        gap: 4px;
    }

    .calendar-cell {
        padding: 6px 5px 24px;
    }

    .cell-date {
        margin-bottom: 4px;
        font-size: 0.86rem;
    }

    .cell-bottom {
        right: 5px;
        bottom: 9px;
        left: 5px;
    }

    .cell-bars {
        gap: 3px;
    }

    .cell-bars i {
        height: 5px;
    }

    .chart-floating-button {
        bottom: calc(var(--nav-height) + var(--safe-bottom) + 7px);
        height: 32px;
    }

    .detail-map {
        height: clamp(170px, 28dvh, 230px);
    }

    .detail-content {
        padding-top: 18px;
    }

    .detail-summary h2 {
        font-size: clamp(1.18rem, 5.4vw, 1.45rem);
    }

    .detail-section {
        margin-top: 24px;
        padding-top: 18px;
    }

    .detail-section h3 {
        margin-bottom: 18px;
        font-size: 1.25rem;
    }

    .detail-content .metric-grid.six {
        gap: 14px 10px;
    }

    .metric-grid div {
        min-height: 58px;
    }

}
