:root { 
    color-scheme: dark; --ink:#f3f0e8; --muted:#9da8ae; --accent:#ff7654; --line:rgba(243,240,232,.18); 
}

* { 
    box-sizing: border-box; 
}

.settings-document {
    overflow: auto;
}

html, body { 
    margin: 0; 
    width: 100%; 
    height: 100%; 
    overflow: hidden;
    background: #111; 
}

body { 
    font-family: "Trebuchet MS", "Segoe UI", sans-serif; 
    touch-action: none; 
    user-select: none; 
}

#game { 
    display: block; 
    width: 100vw; 
    height: 100vh; 
    background: #171717; 
}

.hud { 
    position: fixed; 
    inset: 0; 
    pointer-events: none; 
    padding: 18px 22px; 
    color: var(--ink); 
}

.topline { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    gap: 16px; 
}

.brand { 
    font-size: 13px; 
    letter-spacing: .22em; 
    font-weight: 700; 
    text-transform: uppercase; 
}

.brand-mark { 
    color:var(--accent); 
    font-size: 20px;
    vertical-align: -2px; 
}

.world-name { 
    margin-top: 7px; 
    color: var(--muted); 
    font-size: 11px; 
    letter-spacing: .11em; 
}

.dot { 
    opacity: .4; 
    margin: 0 8px; 
}

.stats { 
    display: flex; 
    gap: 20px; 
    text-align: right; 
    color: var(--muted); 
    letter-spacing: .1em; 
    text-transform: uppercase; 
}

.stats span { 
    display: block; 
    font-size: 10px; 
}

.stats strong { 
    display: block; 
    color: var(--ink); 
    font-size: 19px; 
    letter-spacing: 0; 
}

.stats small { 
    font-size: 10px; 
    color: var(--muted); 
    margin-left: 2px; 
}

.progress { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 3px; 
    background: var(--line); 
}

.progress span { 
    display: block; 
    width: 0; 
    height: 100%; 
    background:var(--accent); 
    transition: width .15s ease; 
}

.settings-button,
.menu-settings-button,
.menu-credits-button {
    position: absolute;
    top: 68px;
    right: 68px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    pointer-events: auto;
    color: var(--ink);
    background: rgba(15,20,24,.72);
    border: 1px solid var(--line);
    border-radius: 50%;
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
    box-shadow: 0 0 0 1px rgba(255,255,255,.04);
    z-index: 200;
}

.menu-credits-button {
    right: 114px;
    font: 700 16px Georgia, serif;
    font-style: italic;
}

.settings-button:hover,
.menu-settings-button:hover,
.menu-credits-button:hover {
    border-color: var(--ink);
    transform: translateY(-1px);
}

.music-button {
    position: absolute;
    top: 68px;
    right: 22px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    pointer-events: auto;
    color: var(--muted);
    background: rgba(15,20,24,.72);
    border: 1px solid var(--line);
    border-radius: 50%;
}

.music-button-icon {
    position: relative;
    width: 17px;
    height: 17px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.music-button.is-playing {
    color: var(--accent);
}

.music-button.is-playing .music-button-icon {
    box-shadow: 0 0 8px currentColor;
}

.music-button-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.help { 
    position: absolute; 
    left: 22px; 
    bottom: 18px; 
    color: var(--muted); 
    font-size: 11px; 
    letter-spacing: .04em;
}

.help b,.help span { display: block; }.help b { color: var(--ink); font-size: 12px; margin-bottom: 3px; }

.controls { 
    position: absolute; 
    right: 18px; 
    bottom: 16px; 
    display: flex; 
    gap: 8px;
    pointer-events: auto; 
}

button { 
    border: 1px solid var(--line); 
    border-radius: 4px;
    padding: 9px 12px; 
    color: var(--ink); 
    background: rgba(15,20,24,.7);
    font: 700 11px inherit; 
    letter-spacing: .08em; 
    text-transform: uppercase; 
    transition: background .18s,border-color .18s,transform .18s; 
} 

button:hover { 
    border-color: var(--ink); 
    transform: translateY(-1px); 
}

button:active { 
    background: var(--accent); 
    border-color: var(--accent); 
}

body[data-motion="reduced"] *,
body[data-motion="reduced"] *::before,
body[data-motion="reduced"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

body[data-contrast="high"] {
    --accent: #ffd166;
    --ink: #fffaf0;
    --muted: #dfe9ff;
    --line: rgba(255, 250, 240, 0.38);
}

.overlay { 
    position: fixed; 
    inset: 0; 
    display: grid; 
    place-items: center; 
    padding: 22px; 
    pointer-events: none; 
}

.panel {
    display: flex; 
    align-items: center; 
    justify-content: center; 
    flex-direction: column; 
    max-width: 500px; 
    height: 400px; 
    text-align: center; 
    pointer-events: auto; 
    z-index: 100;
}
.bg{
    opacity: 0.2;
    position: fixed;
    width: 100%;
    height: 500px;
    object-fit: cover;
    -webkit-mask-image: radial-gradient( #737438 30%,transparent);
    mask-image: radial-gradient(#737438 30%, transparent);
}

.panel h1 { 
    margin: 0 0 10px; 
    color: var(--ink); 
    font-size: clamp(32px,8vw,64px); 
    line-height: .95; 
    letter-spacing: -.04em; 
    text-shadow: 
        0 0 26px #111 /*offset, radius, color*/
}

.panel p { 
    margin: 0 0 12px;
    color: var(--ink);
    font-weight: bold;
    font-size: 14px;
    line-height: 1.5; 
    text-shadow: 
        0 0 6px #1d1c1c; /*offset, radius, color*/
}
    
.overlay-stats { 
    min-height: 16px; 
    margin-bottom: 18px;
    color: var(--accent);
    font-size: 11px;
    letter-spacing: .12em;
}

.panel button { 
    background: var(--accent); 
    border-color: var(--accent); 
    padding: 12px 18px; 
}

.hidden { display: none; }

@media (max-width: 600px) { 
    .hud { padding: 14px 15px; } 
    .music-button { top: 72px; right: 15px; }
    .stats { gap: 10px; }
    .stats strong { font-size: 16px; }
    .help { left: 15px; bottom: 66px; max-width: 210px; line-height: 1.4; } 
    .controls { right: 15px; bottom: 14px; } 
    button { padding: 10px; } 
}


/* UHHHH stuff im doing :P*/
@keyframes bouncy {
    0%{transform: translateY(1em) scale(0.75);}
    50%{transform: translateY(0em) scale(1);}
    100%{transform: translateY(1em) scale(0.75);}
}
@keyframes bouncy2 {
    0%{transform: translateY(1em) scale(0.8);}
    50%{transform: translateY(0em) scale(0.9);}
    100%{transform: translateY(1em) scale(0.8);}
}
#logo{
    width: 300px;
    height: 300px;
    animation: bouncy 2s ease-in-out infinite;
}
#ins{
    width: 250px;
    height: 250px;
    animation: bouncy2 1.5s ease-in-out infinite;
}
#main_menu_div{
    display:grid;
    height: 100%;
    width: 100%;
    
}

.story-page {
    overflow: auto;
    touch-action: pan-y;
}

.story-page #main_menu_div {
    min-height: 100%;
    height: auto;
}

.story-page #content_div {
    overflow: visible;
}

#content_div,
#bg_div{
    grid-column: 1; 
    grid-row: 1; 
    overflow: hidden; 
}
#bg_div{
    position: fixed;
    inset: 0;
    background: #111;
}
#long_img{
    position: absolute; 
    left: 0; 
    width: auto;
    height: 100%;
    object-fit: contain;
    min-width: 100%; 
    max-width: none; 
    object-position: center;
    transition: transform 2s cubic-bezier(0.7,0,1,1);
}
#content_div{
    z-index: 100;
}
#long_img.animation{
    transform: translateX(-500vw);
}
#title{
    font-size: 5em;
    text-align: center; 
    justify-self: center; 
}
button{
    width: 10em; 
    height: 9ch;
}
#buttons button{
    width: min(18rem, 84vw);
    min-height: 3.4rem;
    height: auto;
}
#buttons{
    display: flex; 
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3em; 
}
#grid{
    padding: 30px;
    display: grid; 
    grid-template-columns: repeat(3, 1fr);
    gap: 1em;
    margin: 0 auto; 
}
.item{
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    padding: 0px 50px;
    background-color:#ff76544c;
    border: 6px rgba(227, 46, 46, 0.208) solid;
}
#row{
    display: flex; 
    flex-direction: row; 
    align-items: center; 
    justify-content: left; 
    gap: 5em;
    padding: 1em;
}
#overlayButton{
    width: 15em;
}
.small{
    width: 80px !important;
    height: 80px !important;
}

.touch-controls {
    display: none;
}

.level-editor-page {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    touch-action: pan-y;
    user-select: auto;
    background:
        linear-gradient(rgba(10, 12, 13, .74), rgba(10, 12, 13, .84)),
        url("assets/harvestbg.jpg") center / cover fixed no-repeat;
    color: var(--ink);
}

.editor-shell {
    width: min(1120px, 100%);
    height: 100%;
    min-height: 0;
    margin: 0 auto;
    padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.editor-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.editor-header h1 {
    margin: 0;
    font-size: clamp(2rem, 6vw, 3.4rem);
    line-height: 1;
    letter-spacing: -.05em;
    text-transform: uppercase;
}

.editor-intro {
    max-width: 620px;
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.editor-back {
    flex: 0 0 auto;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--ink);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.editor-field {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #171717;
}

#editorCanvas {
    display: block;
    width: 100%;
    height: min(58vh, 480px);
    min-height: 230px;
    touch-action: none;
}

.editor-view {
    display: grid;
    grid-template-columns: auto minmax(80px, 1fr) 62px;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.editor-view input {
    width: 100%;
    accent-color: var(--accent);
}

.editor-view output {
    color: var(--ink);
    text-align: right;
}

.editor-tools,
.editor-save {
    margin-top: 22px;
}

.editor-tool-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.editor-tool,
.editor-actions button,
.editor-saved-row button {
    width: auto;
    height: auto;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 11px;
    touch-action: manipulation;
}

.editor-tool.is-selected,
.editor-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #171717;
}

.editor-hint,
.editor-status {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.editor-save {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-width: 760px;
}

.editor-field-label {
    margin-top: 6px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.editor-save input,
.editor-save select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: rgba(15,20,24,.82);
    color: var(--ink);
    font: inherit;
}

.editor-saved-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
}

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.editor-status.is-error {
    color: #ff9b9b;
}

@media (max-width: 700px) {
    .hud {
        padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
    }

    .brand {
        font-size: 11px;
    }

    .world-name {
        max-width: 44vw;
        font-size: 9px;
        line-height: 1.4;
    }

    .stats {
        gap: 8px;
    }

    .stats span {
        font-size: 8px;
    }

    .stats strong {
        font-size: 14px;
    }

    .stats > div:nth-child(2) {
        display: none;
    }

    .music-button {
        top: 68px;
        right: max(12px, env(safe-area-inset-right));
    }

    .help {
        left: max(12px, env(safe-area-inset-left));
        bottom: 116px;
        max-width: 48vw;
        font-size: 10px;
        line-height: 1.4;
    }

    .help b {
        font-size: 11px;
    }

    .controls {
        right: max(12px, env(safe-area-inset-right));
        bottom: max(10px, env(safe-area-inset-bottom));
        gap: 6px;
    }

    .controls button {
        width: auto;
        height: auto;
        min-height: 44px;
        padding: 10px;
        font-size: 9px;
        touch-action: manipulation;
    }

    .touch-controls {
        position: fixed;
        right: max(14px, env(safe-area-inset-right));
        bottom: 74px;
        display: grid;
        grid-template-columns: repeat(2, 46px);
        gap: 5px;
        pointer-events: auto;
    }

    .touch-controls button {
        width: 46px;
        height: 46px;
        padding: 0;
        border-radius: 12px;
        font-size: 20px;
        touch-action: manipulation;
        background: rgba(15,20,24,.88);
    }

    .editor-shell {
        padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    }

    .editor-header {
        align-items: flex-start;
        gap: 12px;
    }

    .editor-back {
        padding: 10px;
        font-size: 10px;
    }

    .editor-intro {
        font-size: 13px;
    }

    #editorCanvas {
        height: auto;
        min-height: 0;
        aspect-ratio: 16 / 9;
    }

    .editor-view {
        grid-template-columns: 1fr auto;
        gap: 6px 10px;
        padding: 9px 10px;
    }

    .editor-view span {
        grid-column: 1 / -1;
    }

    .editor-tool-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .editor-tool {
        padding: 10px 6px;
        font-size: 10px;
    }

    .editor-saved-row {
        grid-template-columns: minmax(0, 1fr) auto auto;
        gap: 5px;
    }

    .editor-saved-row button {
        padding: 8px;
        font-size: 9px;
    }

    .editor-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .editor-actions button {
        width: 100%;
        padding: 10px 6px;
        font-size: 9px;
    }
}

.settings-page {
    overflow: auto;
    position: relative;
    min-height: 100%;
    background: transparent;
    color: var(--ink);
}

.settings-document {
    background:
        linear-gradient(rgba(10, 12, 13, .62), rgba(10, 12, 13, .62)),
        url("assets/harvestbg.jpg") center top / cover fixed no-repeat;
}

.settings-shell {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 54px 7vw 40px;
    background: transparent;
}

.settings-shell::before,
.settings-shell::after {
    content: "";
    position: fixed;
    z-index: 0;
    pointer-events: none;
    background: var(--accent);
    opacity: .8;
}

.settings-shell::before {
    top: 0;
    left: 0;
    width: 38%;
    height: 3px;
}

.settings-shell::after {
    right: 22px;
    bottom: 22px;
    width: 3px;
    height: 42px;
}

.settings-card {
    position: relative;
    z-index: 1;
    width: min(460px, 100%);
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.settings-header {
    margin-bottom: 26px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.settings-logo {
    display: block;
    width: 82px;
    height: 82px;
    margin-bottom: 14px;
    object-fit: contain;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
    font-weight: 700;
}

.settings-header h1 {
    margin: 0;
    font-size: clamp(2rem, 7vw, 3rem);
    line-height: .95;
    letter-spacing: -.04em;
    text-transform: uppercase;
}

.credits-section {
    margin-top: 26px;
}

.credits-section h2 {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 10px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.credits-section p {
    margin: 0;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.credits-section strong,
.credits-section span {
    display: block;
}

.credits-section strong {
    color: var(--ink);
}

.credits-section span {
    font-size: 11px;
}

.settings-form {
    display: grid;
    gap: 26px;
}

.settings-group {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.settings-group legend {
    width: 100%;
    margin-bottom: 10px;
    padding: 0;
    color: var(--accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.setting-row {
    display: grid;
    gap: 10px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-size: 13px;
}

.toggle-row {
    grid-template-columns: 1fr auto;
    align-items: center;
}

.slider-wrap {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

input[type="range"] {
    accent-color: var(--accent);
    width: 100%;
    cursor: pointer;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.settings-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 30px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.secondary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 4px;
    text-decoration: none;
    font: 700 11px inherit;
    letter-spacing: .08em;
    text-transform: uppercase;
    transition: background .18s, border-color .18s, transform .18s;
}

.secondary-button {
    background: var(--accent);
    color: #171717;
    border: 1px solid var(--accent);
}

.ghost-button {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}

.secondary-button:hover,
.ghost-button:hover {
    border-color: var(--ink);
    transform: translateY(-1px);
}

.secondary-button:active,
.ghost-button:active {
    background: var(--accent);
    border-color: var(--accent);
}

@media (max-width: 600px) {
    .settings-shell {
        padding: 30px 15px;
    }

    .settings-card {
        padding: 22px 18px;
    }

    .settings-actions {
        flex-direction: column;
    }

    .secondary-button,
    .ghost-button {
        width: 100%;
    }

    .menu-settings-button,
    .settings-button,
    .menu-credits-button {
        top: 72px;
        right: 16px;
    }

    .menu-credits-button {
        right: 62px;
    }
}