@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap');

:root {
    --ink: #203129;
    --forest: #203a2e;
    --forest-2: #315342;
    --moss: #839578;
    --cream: #f3ecda;
    --paper: #fffaf0;
    --gold: #d9ad59;
    --gold-light: #f1d994;
    --terracotta: #a85e43;
    --line: rgba(30, 53, 42, .2);
    --shadow: 0 14px 35px rgba(19, 34, 27, .2);
    --topbar: 42px;
}

* { box-sizing: border-box; }
html { background: #1b2e25; min-width: 320px; }
body {
    color: var(--ink);
    font-family: "DM Sans", sans-serif;
    margin: 0;
    min-height: 100vh;
    overflow: hidden;
}
button { font: inherit; -webkit-tap-highlight-color: transparent; }

.topbar {
    align-items: center;
    background: #17291f;
    border-bottom: 1px solid rgba(255,255,255,.12);
    color: white;
    display: flex;
    height: var(--topbar);
    justify-content: space-between;
    padding: 0 16px;
    position: relative;
    z-index: 20;
}
.brand {
    color: #fff8df;
    font-family: "Fraunces", serif;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}
.brand span { color: var(--gold-light); margin-right: 5px; }
.topbar nav { display: flex; gap: 3px; }
.topbar nav button {
    background: transparent;
    border: 0;
    border-left: 1px solid rgba(255,255,255,.13);
    color: rgba(255,255,255,.72);
    cursor: pointer;
    font-size: 11px;
    padding: 5px 12px;
}
.topbar nav button:hover { color: white; }

.game-grid {
    display: grid;
    grid-template-columns: minmax(310px, 30%) minmax(390px, 1fr) minmax(320px, 25%);
    height: calc(100vh - var(--topbar));
}
.game-grid > * { min-width: 0; }

.clicker-column {
    background:
        linear-gradient(rgba(25,45,35,.68), rgba(19,36,27,.86)),
        url("../images/journey.webp") 57% center / cover;
    border-right: 7px ridge rgba(229,205,148,.44);
    color: white;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    position: relative;
}
.clicker-column::after {
    background: radial-gradient(circle at center, transparent 25%, rgba(4,16,10,.28) 100%);
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
}
.column-title, .resource-counter, .clicker-stage, .left-stats, .focus-button { position: relative; z-index: 2; }
.column-title {
    background: linear-gradient(90deg, transparent, rgba(15,27,21,.78), transparent);
    padding: 13px 10px 10px;
    text-align: center;
}
.column-title small {
    color: var(--gold-light);
    display: block;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .16em;
}
.column-title strong {
    display: block;
    font-family: "Fraunces", serif;
    font-size: 18px;
    margin-top: 3px;
}
.resource-counter {
    background: rgba(9,20,14,.46);
    border-bottom: 1px solid rgba(255,255,255,.09);
    border-top: 1px solid rgba(255,255,255,.09);
    padding: 8px;
    text-align: center;
    text-shadow: 0 2px 5px rgba(0,0,0,.45);
}
.resource-counter strong {
    display: block;
    font-family: "Fraunces", serif;
    font-size: clamp(23px, 2.2vw, 33px);
    line-height: 1.1;
}
.resource-counter > span { font-size: 11px; opacity: .78; }

.clicker-stage {
    align-items: center;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: center;
    min-height: 210px;
    overflow: hidden;
}
.light-rays {
    animation: slow-spin 60s linear infinite;
    background: repeating-conic-gradient(from 0deg, rgba(255,239,182,.1) 0 8deg, transparent 8deg 20deg);
    border-radius: 50%;
    height: min(42vw, 540px);
    position: absolute;
    width: min(42vw, 540px);
}
@keyframes slow-spin { to { transform: rotate(360deg); } }
.main-action {
    background:
        radial-gradient(circle at 36% 29%, #fff8d9 0 4%, #e5c477 24%, #8a6940 58%, #294638 60%, #1b3127 72%);
    border: 8px solid rgba(255,250,221,.22);
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(11,29,20,.4), 0 20px 45px rgba(4,16,9,.54), inset 0 0 25px rgba(255,245,195,.35);
    color: #fff7db;
    cursor: pointer;
    height: clamp(180px, 20vw, 270px);
    position: relative;
    text-shadow: 0 2px 6px rgba(0,0,0,.45);
    transition: filter .15s, transform .08s;
    width: clamp(180px, 20vw, 270px);
}
.main-action:hover { filter: brightness(1.1); transform: scale(1.025); }
.main-action:active, .main-action.is-clicked { transform: scale(.93); }
.main-action:focus-visible { outline: 4px solid #fff; outline-offset: 5px; }
.mind-rings {
    border: 1px solid rgba(255,244,196,.35);
    border-radius: 50%;
    inset: 15%;
    position: absolute;
}
.mind-rings::after {
    border: 1px dashed rgba(255,244,196,.3);
    border-radius: 50%;
    content: "";
    inset: 15%;
    position: absolute;
}
.mind-icon {
    display: block;
    font-family: serif;
    font-size: clamp(54px, 6vw, 78px);
    line-height: .8;
    transform: rotate(-32deg);
}
.action-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .16em;
    margin-top: 12px;
}
.clicker-stage > p {
    background: rgba(14,29,21,.5);
    border-radius: 20px;
    font-size: 10px;
    margin: 13px 0 0;
    padding: 5px 10px;
}

.left-stats {
    background: rgba(10,24,16,.66);
    border-bottom: 1px solid rgba(255,255,255,.1);
    border-top: 1px solid rgba(255,255,255,.12);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 9px 6px;
}
.left-stats > div { border-right: 1px solid rgba(255,255,255,.12); text-align: center; }
.left-stats > div:last-child { border: 0; }
.left-stats span { color: var(--gold-light); font-size: 15px; }
.left-stats small { display: block; font-size: 7px; letter-spacing: .06em; opacity: .6; text-transform: uppercase; }
.left-stats strong { display: block; font-family: "Fraunces", serif; font-size: 13px; margin-top: 2px; }
.focus-button {
    align-items: center;
    background: linear-gradient(#f0dfae, #cfaa66);
    border: 0;
    color: #2d4337;
    cursor: pointer;
    display: flex;
    gap: 10px;
    justify-content: center;
    min-height: 48px;
    padding: 8px 12px;
}
.focus-button > span:first-child { font-size: 22px; }
.focus-button strong, .focus-button small { display: block; text-align: left; }
.focus-button strong { font-family: "Fraunces", serif; font-size: 13px; }
.focus-button small { font-size: 8px; opacity: .74; }
.focus-button:disabled { cursor: default; filter: grayscale(.7); opacity: .7; }

.story-column {
    background:
        linear-gradient(rgba(246,240,222,.92), rgba(246,240,222,.96)),
        repeating-linear-gradient(0deg, transparent 0 28px, rgba(54,76,64,.05) 28px 29px);
    border-right: 7px ridge rgba(82,70,45,.28);
    overflow-y: auto;
    scrollbar-color: #84927b transparent;
}
.news-ticker {
    align-items: center;
    background: #e4d7b8;
    border-bottom: 1px solid #bdae89;
    display: flex;
    min-height: 34px;
}
.news-ticker span {
    align-self: stretch;
    align-items: center;
    background: var(--terracotta);
    color: white;
    display: flex;
    flex: 0 0 auto;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .08em;
    padding: 0 10px;
}
.news-ticker p {
    animation: news-in .4s ease;
    font-family: "Fraunces", serif;
    font-size: 11px;
    margin: 0;
    overflow: hidden;
    padding: 0 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@keyframes news-in { from { opacity: 0; transform: translateY(4px); } }

.career-scene {
    background: url("../images/journey.webp") center 43% / cover;
    min-height: 290px;
    overflow: hidden;
    position: relative;
}
.scene-shade { background: linear-gradient(90deg, rgba(21,37,28,.83), rgba(21,37,28,.22) 72%), linear-gradient(0deg, rgba(18,31,23,.5), transparent 65%); inset: 0; position: absolute; }
.scene-copy {
    bottom: 32px;
    color: white;
    left: 32px;
    max-width: 430px;
    position: absolute;
    right: 25px;
}
.scene-copy small { color: var(--gold-light); font-size: 8px; font-weight: 700; letter-spacing: .15em; }
.scene-copy h1 { font-family: "Fraunces", serif; font-size: clamp(28px, 3.2vw, 47px); letter-spacing: -.035em; line-height: 1; margin: 8px 0 10px; }
.scene-copy p { font-size: 11px; line-height: 1.55; margin: 0; max-width: 380px; opacity: .86; }
.clarity-event {
    animation: clarity-pulse 1.6s ease-in-out infinite;
    background: radial-gradient(circle, #fffbd7, #e1b85e 48%, #87642d 70%);
    border: 4px solid rgba(255,255,255,.48);
    border-radius: 50%;
    box-shadow: 0 0 35px #ffe699;
    color: #2e4838;
    cursor: pointer;
    height: 78px;
    position: absolute;
    right: 9%;
    top: 18%;
    width: 78px;
}
.clarity-event span { display: block; font-size: 27px; }
.clarity-event small { display: block; font-size: 8px; font-weight: 700; }
@keyframes clarity-pulse { 50% { filter: brightness(1.22); transform: scale(1.08) rotate(5deg); } }

.progress-card {
    background: #263e32;
    color: white;
    padding: 13px 22px;
}
.progress-heading { align-items: end; display: flex; justify-content: space-between; }
.progress-heading small { color: #c1cbbd; display: block; font-size: 7px; letter-spacing: .1em; }
.progress-heading strong { font-family: "Fraunces", serif; font-size: 14px; }
.progress-heading > span { color: #dce5d7; font-size: 9px; }
.progress-track { background: rgba(255,255,255,.13); border-radius: 5px; height: 6px; margin-top: 9px; overflow: hidden; }
.progress-track span { background: linear-gradient(90deg, #ba9450, #f0d48d); display: block; height: 100%; transition: width .3s; width: 0; }

.career-path { padding: 23px; }
.section-heading { align-items: center; display: flex; justify-content: space-between; margin-bottom: 18px; }
.section-heading small, .store-heading small { color: #7d897f; display: block; font-size: 7px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.section-heading h2, .store-heading h2 { font-family: "Fraunces", serif; font-size: 21px; margin: 2px 0 0; }
.section-heading > span { background: #e2e7dc; border-radius: 15px; color: #58705b; font-size: 8px; padding: 6px 9px; }
.career-path ol { display: grid; gap: 6px; list-style: none; margin: 0; padding: 0; }
.career-path li {
    align-items: center;
    background: rgba(255,255,255,.52);
    border: 1px solid rgba(49,74,59,.12);
    border-radius: 8px;
    display: grid;
    gap: 11px;
    grid-template-columns: 31px 1fr auto;
    min-height: 50px;
    padding: 7px 9px;
}
.career-path .node { align-items: center; background: #e5e8df; border-radius: 50%; display: flex; height: 30px; justify-content: center; width: 30px; }
.career-path .done .node { background: var(--forest-2); color: white; }
.career-path .current { border-color: #c8a25c; box-shadow: inset 3px 0 #c8a25c; }
.career-path .current .node { background: var(--gold-light); }
.career-path strong { display: block; font-family: "Fraunces", serif; font-size: 12px; }
.career-path small { color: #7d867f; display: block; font-size: 8px; }
.career-path .status { color: #929b94; font-size: 7px; font-weight: 700; text-transform: uppercase; }

.store-column {
    background: #e9e1cf;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.upgrade-shelf {
    background: #d5c8a9;
    border-bottom: 5px ridge rgba(100,80,46,.34);
    padding: 9px 10px 11px;
}
.store-heading { align-items: end; display: flex; justify-content: space-between; }
.store-heading h2 { font-size: 19px; }
.perk-list {
    display: grid;
    gap: 5px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 8px;
}
.perk {
    background: linear-gradient(145deg, #fff8db, #d5bd7c);
    border: 2px ridge #a78349;
    color: var(--ink);
    cursor: pointer;
    height: 48px;
    overflow: hidden;
    padding: 3px;
    position: relative;
    text-align: center;
}
.perk span { display: block; font-size: 20px; line-height: 1.15; }
.perk small { display: block; font-size: 6px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perk:disabled { cursor: default; filter: grayscale(1); opacity: .38; }
.perk.owned { background: #81917a; color: white; filter: none; opacity: .65; }

.producer-heading {
    background: #263e32;
    color: white;
    min-height: 48px;
    padding: 7px 9px;
}
.producer-heading small { color: #aebcaf; }
.buy-modes { display: flex; gap: 2px; }
.buy-modes button {
    background: #40594b;
    border: 1px solid rgba(255,255,255,.14);
    color: #dbe4d9;
    cursor: pointer;
    font-size: 8px;
    padding: 5px 6px;
}
.buy-modes button.active { background: var(--gold); color: #24362c; font-weight: 700; }
.producer-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-color: #758676 #d7cfbd; }
.producer {
    align-items: center;
    background:
        linear-gradient(90deg, rgba(249,244,227,.96), rgba(226,215,189,.95)),
        url("../images/journey.webp") center / cover;
    border: 0;
    border-bottom: 1px solid #afa282;
    box-shadow: inset 0 1px rgba(255,255,255,.7);
    color: var(--ink);
    cursor: pointer;
    display: grid;
    gap: 8px;
    grid-template-columns: 50px 1fr auto;
    min-height: 65px;
    padding: 6px 9px;
    text-align: left;
    transition: filter .15s, padding .15s;
    width: 100%;
}
.producer:hover:not(:disabled) { filter: brightness(1.07); padding-left: 13px; }
.producer:disabled { cursor: default; filter: grayscale(.65); opacity: .55; }
.producer-icon { align-items: center; background: rgba(41,62,50,.12); border: 1px solid rgba(41,62,50,.17); border-radius: 50%; display: flex; font-size: 27px; height: 46px; justify-content: center; width: 46px; }
.producer h3 { font-family: "Fraunces", serif; font-size: 14px; margin: 0; }
.producer p { color: #6f786f; font-size: 7px; line-height: 1.3; margin: 2px 0 0; }
.producer-price { color: #5d6d5c; display: block; font-size: 9px; font-weight: 700; margin-top: 3px; }
.producer-owned {
    color: rgba(39,57,47,.43);
    font-family: "Fraunces", serif;
    font-size: 31px;
    min-width: 38px;
    text-align: right;
}

.float-number {
    animation: float-away .9s ease-out forwards;
    color: #fff3b9;
    font-family: "Fraunces", serif;
    font-size: 20px;
    font-weight: 700;
    pointer-events: none;
    position: fixed;
    text-shadow: 0 2px 8px #000;
    z-index: 60;
}
@keyframes float-away { to { opacity: 0; transform: translateY(-70px) scale(1.18); } }
.toast-region { bottom: 18px; display: grid; gap: 6px; left: 50%; position: fixed; transform: translateX(-50%); z-index: 100; }
.toast { animation: toast-in .3s ease; background: #1e352a; border: 1px solid rgba(255,255,255,.2); border-radius: 6px; box-shadow: var(--shadow); color: white; font-size: 10px; max-width: 340px; padding: 10px 14px; text-align: center; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

dialog {
    background: var(--paper);
    border: 3px ridge #b89c64;
    border-radius: 10px;
    box-shadow: 0 25px 80px rgba(12,25,17,.52);
    color: var(--ink);
    max-width: 470px;
    padding: 32px;
    text-align: center;
}
dialog::backdrop { background: rgba(15,29,21,.7); backdrop-filter: blur(4px); }
dialog h2 { font-family: "Fraunces", serif; font-size: 30px; margin: 4px 0 14px; }
dialog > p:not(.eyebrow) { color: #667169; font-size: 12px; line-height: 1.6; }
.eyebrow { color: #9b7030; font-size: 8px; font-weight: 700; letter-spacing: .15em; margin: 0; }
.dialog-leaf { color: #71866f; font-size: 31px; }
.dialog-actions { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }
.dialog-actions button { border: 1px solid var(--line); cursor: pointer; padding: 9px 14px; }
.dialog-actions button:last-child { background: var(--forest); color: white; }
.dialog-close { background: transparent; border: 0; color: #6a756e; cursor: pointer; font-size: 24px; position: absolute; right: 10px; top: 7px; }
#statsList { display: grid; gap: 1px; grid-template-columns: 1fr 1fr; margin: 20px 0 0; text-align: left; }
#statsList dt, #statsList dd { background: #eee9dc; font-size: 10px; margin: 0; padding: 8px; }
#statsList dd { font-family: "Fraunces", serif; font-weight: 700; text-align: right; }

@media (max-width: 960px) {
    body { overflow: auto; }
    .game-grid { grid-template-columns: minmax(290px, 42%) 1fr; height: calc(100vh - var(--topbar)); }
    .story-column { border-right: 0; }
    .store-column { grid-column: 1 / -1; min-height: 600px; overflow: visible; }
    .producer-list { overflow: visible; }
}
@media (max-width: 680px) {
    :root { --topbar: 38px; }
    .game-grid { display: flex; flex-direction: column; height: auto; }
    .clicker-column { border-bottom: 6px ridge rgba(229,205,148,.44); border-right: 0; min-height: 630px; }
    .story-column { border-bottom: 6px ridge rgba(82,70,45,.28); overflow: visible; }
    .career-scene { min-height: 330px; }
    .store-column { min-height: 0; }
    .producer-list { max-height: none; }
    .perk-list { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
