:root {
    --paper: #fff5d8;
    --paper-2: #fffaf0;
    --ink: #261d1a;
    --muted: #776558;
    --line: #e1bd7a;
    --green: #2f8c67;
    --green-dark: #19523d;
    --blue: #2d6ea4;
    --red: #ca5648;
    --gold: #d59a2f;
    --violet: #7d5bb6;
    --shadow: 0 22px 54px rgba(78, 43, 22, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: radial-gradient(circle at 8% 10%, rgba(202, 86, 72, 0.26), transparent 28%), radial-gradient(circle at 88% 4%, rgba(45, 110, 164, 0.24), transparent 30%), radial-gradient(circle at 78% 88%, rgba(47, 140, 103, 0.26), transparent 28%), linear-gradient(135deg, #ffe1a8 0%, #fff5d8 38%, #d8f0dd 74%, #d4e6ff 100%);
    font-family: "Poppins", "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(121, 85, 42, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(121, 85, 42, 0.05) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent);
}

button,
input,
select,
textarea {
    font-family: "Poppins", "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

i[class^="fa-"],
i[class*=" fa-"] {
    line-height: 1;
}

.shell {
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
    padding: 24px 0 54px;
}

.topbar,
.panel-head,
.calendar-head,
.hero-stats,
.timer-actions,
.diary-entry {
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar,
.panel-head,
.calendar-head,
.diary-entry {
    gap: 16px;
}

.topbar {
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--green-dark);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 6vw, 4.8rem);
    line-height: 1;
}

h2 {
    margin-bottom: 0;
    font-size: 1.35rem;
}

h3 {
    margin: 22px 0 10px;
    font-size: 1rem;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 330px);
    gap: 24px;
    align-items: stretch;
    min-height: 320px;
    margin-bottom: 18px;
    padding: clamp(22px, 5vw, 42px);
    color: #fff;
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, rgba(31, 43, 35, 0.88) 0%, rgba(31, 43, 35, 0.68) 38%, rgba(31, 43, 35, 0.18) 72%), url("images/journey-hero.png");
    background-position: center;
    background-size: cover;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hero::after {
    content: "";
    position: absolute;
    inset: 14px;
    pointer-events: none;
    border: 1px solid rgba(255, 245, 216, 0.42);
    border-radius: 6px;
}

.hero-copy {
    position: relative;
    z-index: 1;
    align-self: end;
}

.hero h2 {
    max-width: 760px;
    margin-bottom: 12px;
    font-size: clamp(2.1rem, 6vw, 4.6rem);
    line-height: 1.06;
}

.hero p {
    max-width: 720px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

.meter {
    height: 13px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.26);
    border-radius: 999px;
}

.meter span {
    display: block;
    height: 100%;
    background: #f7ca55;
    border-radius: inherit;
}

.hero-stats {
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.hero-stats span,
.passport,
.book-panel,
.stat-grid article {
    border: 1px solid rgba(217, 199, 167, 0.9);
    background: rgba(255, 250, 240, 0.95);
}

.hero-stats span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    color: var(--ink);
    border-radius: 999px;
    font-weight: 900;
}

.passport {
    display: grid;
    place-items: center;
    align-content: center;
    min-height: 280px;
    padding: 12px;
    color: var(--ink);
    border-radius: 10px;
    text-align: center;
    position: relative;
    z-index: 1;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.party-passport {
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 10px;
}

.sprite-frame {
    width: 100%;
    aspect-ratio: 1.05 / 1;
    background-repeat: no-repeat;
    background-size: 500% 300%;
    background-position: 0 0;
}

.avatar-sprite {
    background-image: url("images/avatar-sprite.png");
}

.pet-sprite {
    background-image: url("images/pet-sprite.png");
}

.equipment-sprite {
    background-image: url("images/equipment-sprite.png");
}

.sprite-stage-0 { background-position: 0% 0%; }
.sprite-stage-1 { background-position: 25% 0%; }
.sprite-stage-2 { background-position: 50% 0%; }
.sprite-stage-3 { background-position: 75% 0%; }
.sprite-stage-4 { background-position: 100% 0%; }
.sprite-stage-5 { background-position: 0% 50%; }
.sprite-stage-6 { background-position: 25% 50%; }
.sprite-stage-7 { background-position: 50% 50%; }
.sprite-stage-8 { background-position: 75% 50%; }
.sprite-stage-9 { background-position: 100% 50%; }
.sprite-stage-10 { background-position: 0% 100%; }
.sprite-stage-11 { background-position: 25% 100%; }
.sprite-stage-12 { background-position: 50% 100%; }
.sprite-stage-13 { background-position: 75% 100%; }
.sprite-stage-14 { background-position: 100% 100%; }

.party-passport .avatar-sprite {
    width: 100%;
    border: 1px solid rgba(213, 154, 47, 0.65);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(43, 29, 18, 0.18);
}

.party-passport .passport-info {
    display: grid;
    gap: 3px;
    width: 100%;
    padding: 10px 8px 8px;
    background: linear-gradient(180deg, rgba(255, 250, 240, 0.92), rgba(255, 240, 202, 0.94));
    border-radius: 8px;
}

.passport span {
    color: var(--gold);
    font-size: clamp(2rem, 6vw, 3.4rem);
    font-weight: 950;
    line-height: 1;
}

.passport strong {
    margin-top: 8px;
    font-size: 1.15rem;
}

.passport small,
.muted,
.stat-grid span,
.stat-grid small,
.collection small {
    color: var(--muted);
}

.dashboard {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 18px;
    margin-bottom: 18px;
}

.arrival-banner {
    margin-bottom: 18px;
    min-height: 190px;
    padding: 22px;
    color: #fff;
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, rgba(112, 47, 38, 0.95), rgba(213, 154, 47, 0.72)), url("images/items.png");
    background-position: center;
    background-size: cover;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.arrival-banner>* {
    position: relative;
    z-index: 1;
}

.arrival-banner img {
    position: absolute;
    right: 14px;
    bottom: -28px;
    width: min(48vw, 430px);
    opacity: 0.35;
    filter: saturate(1.15);
}

.arrival-banner .eyebrow {
    color: #fff6d9;
}

.arrival-banner h2 {
    margin-bottom: 12px;
    font-size: clamp(1.8rem, 5vw, 3rem);
}

.arrival-banner div {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.arrival-banner span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--ink);
    background: rgba(255, 250, 240, 0.92);
    border-radius: 999px;
    font-weight: 900;
}

.quote-panel {
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 18px;
    padding: 18px;
    background: rgba(255, 253, 248, 0.96);
    border: 1px solid rgba(217, 199, 167, 0.9);
    border-radius: 8px;
    box-shadow: 0 12px 34px rgba(64, 48, 29, 0.1);
}

.quote-icon {
    display: grid;
    place-items: center;
    width: 58px;
    aspect-ratio: 1;
    color: #fff;
    background: linear-gradient(135deg, var(--gold), var(--green));
    border-radius: 16px;
    font-size: 1.35rem;
}

.quote-panel blockquote {
    margin: 0;
    font-size: clamp(1.1rem, 2.4vw, 1.55rem);
    font-weight: 900;
    line-height: 1.65;
}

.quote-source {
    display: grid;
    gap: 4px;
    margin: 10px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.quote-source small {
    color: var(--muted);
    font-weight: 500;
    line-height: 1.6;
}

.book-panel,
.stat-grid article {
    border-radius: 8px;
    box-shadow: 0 12px 34px rgba(64, 48, 29, 0.12);
}

.book-panel {
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.book-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.55), transparent 32%), radial-gradient(circle at 92% 10%, rgba(213, 154, 47, 0.12), transparent 24%);
}

.book-panel>* {
    position: relative;
    z-index: 1;
}

.auth-panel {
    max-width: 560px;
    margin: 48px auto;
}

.auth-art {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 10px;
    margin-top: 18px;
}

.auth-art img {
    width: 100%;
    height: 220px;
    object-fit: contain;
    background: linear-gradient(180deg, rgba(255, 250, 240, 0.96), rgba(255, 239, 199, 0.92));
    border: 1px solid rgba(213, 154, 47, 0.6);
    border-radius: 8px;
    box-shadow: 0 10px 22px rgba(64, 48, 29, 0.12);
}

.auth-art img:first-child {
    object-position: center center;
}

.form-grid {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 850;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--ink);
    background: #fffef9;
    border: 1px solid var(--line);
    border-radius: 6px;
}

textarea {
    min-height: 84px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    outline: 3px solid rgba(49, 95, 143, 0.16);
}

.primary-button,
.secondary-button,
.tool-button,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 900;
}

.primary-button {
    color: #fff;
    background: var(--green);
}

.secondary-button {
    color: #fff;
    background: var(--blue);
}

.tool-button {
    flex: 1 1 110px;
    color: var(--ink);
    background: #ead9b8;
}

.tool-button.danger,
.icon-button.danger {
    color: #fff;
    background: var(--red);
}

.icon-button {
    width: 44px;
    flex: 0 0 44px;
    color: var(--ink);
    background: #ead9b8;
}

.timer-panel #timerDisplay {
    font-size: clamp(1.5rem, 4vw, 2.3rem);
}

.timer-actions {
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0 4px;
}

#map {
    height: 420px;
    margin-top: 16px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #e4eadf;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-grid article {
    min-height: 116px;
    padding: 17px;
}

.stat-grid span,
.stat-grid small {
    display: block;
}

.stat-grid span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-grid strong {
    display: block;
    margin-top: 8px;
    font-size: clamp(1.9rem, 4vw, 2.7rem);
}

.calendar-head a {
    display: grid;
    place-items: center;
    width: 42px;
    aspect-ratio: 1;
    color: var(--ink);
    background: #ead9b8;
    border-radius: 999px;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 900;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    margin-top: 18px;
}

.calendar b,
.day {
    min-width: 0;
    text-align: center;
}

.calendar b {
    color: var(--muted);
    font-size: 0.8rem;
}

.day {
    display: grid;
    gap: 4px;
    min-height: 74px;
    padding: 8px 4px;
    background: #fffef9;
    border: 1px solid var(--line);
    border-radius: 7px;
}

.day.done {
    color: #fff;
    background: var(--green);
    border-color: var(--green);
}

.day.empty {
    visibility: hidden;
}

.day small {
    overflow-wrap: anywhere;
    font-size: 0.76rem;
}

.pet-mark {
    display: grid;
    place-items: center;
    width: 56px;
    aspect-ratio: 1;
    color: #fff;
    background: var(--green);
    border-radius: 50%;
    font-size: 1.4rem;
    font-weight: 900;
}

.pet-stage {
    margin: 18px 0;
    color: var(--muted);
    font-weight: 750;
}

.pet-portrait,
.item-portrait {
    overflow: hidden;
    border: 1px solid rgba(213, 154, 47, 0.6);
    border-radius: 10px;
    background: #fff8e8;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.pet-portrait {
    margin-top: 16px;
    aspect-ratio: 1.05 / 1;
}

.item-portrait {
    margin: 12px 0 16px;
    aspect-ratio: 1.05 / 1;
}

.pet-portrait .sprite-frame,
.item-portrait .sprite-frame {
    width: 100%;
    height: 100%;
    transition: transform 220ms ease;
}

.companion-panel:hover .pet-portrait .sprite-frame,
.companion-panel:hover .item-portrait .sprite-frame {
    transform: scale(1.035);
}

.collection {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.collection span {
    display: grid;
    gap: 2px;
    min-width: 138px;
    padding: 10px 12px;
    color: var(--muted);
    background: linear-gradient(180deg, #f0e4cb, #ead6ad);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 900;
}

.collection span.unlocked {
    color: var(--ink);
    background: linear-gradient(180deg, #fff6d9, #ffe3a1);
    border-color: var(--gold);
    box-shadow: 0 8px 16px rgba(213, 154, 47, 0.16);
}

.diary-settings {
    grid-template-columns: 1.15fr 0.85fr;
}

.diary-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.diary-entry {
    padding: 14px;
    background: #fffef9;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.diary-entry time,
.diary-entry strong,
.diary-entry p {
    display: block;
}

.diary-entry time {
    color: var(--green-dark);
    font-weight: 900;
}

.diary-entry p {
    margin: 4px 0 0;
    color: var(--muted);
}

.alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    color: #7b241c;
    background: #fde8e2;
    border: 1px solid #f5b7aa;
    border-radius: 8px;
}

.busy-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    place-items: center;
    padding: 20px;
    background: rgba(32, 35, 38, 0.42);
    backdrop-filter: blur(4px);
}

.busy-modal.is-visible {
    display: grid;
}

.busy-box {
    display: grid;
    gap: 14px;
    justify-items: center;
    min-width: min(320px, 100%);
    padding: 26px 24px;
    color: var(--ink);
    background: rgba(255, 253, 248, 0.98);
    border: 1px solid rgba(217, 199, 167, 0.9);
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.busy-spinner {
    width: 46px;
    aspect-ratio: 1;
    border: 5px solid rgba(47, 140, 103, 0.18);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 860px) {
    .hero,
    .dashboard,
    .diary-settings {
        grid-template-columns: 1fr;
    }
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .shell {
        width: min(100% - 18px, 1180px);
        padding-top: 12px;
    }
    .topbar {
        align-items: flex-start;
    }
    .hero {
        min-height: 0;
    }
    .stat-grid {
        grid-template-columns: 1fr;
    }
    .book-panel {
        padding: 16px;
    }
    #map {
        height: 320px;
    }
    .day {
        min-height: 62px;
        padding-inline: 2px;
    }
    .day small {
        font-size: 0.68rem;
    }
    .diary-entry {
        align-items: flex-start;
        flex-direction: column;
    }
}
