/* SUNWICK — page + touch controls */

:root {
    --bone: #d8d0c0;
    --bone-dim: rgba(216, 208, 192, 0.55);
    --soot: rgba(8, 6, 6, 0.46);
    --soot-press: rgba(58, 26, 16, 0.62);
    --ember: #e89a4a;
    --sl: env(safe-area-inset-left, 0px);
    --sr: env(safe-area-inset-right, 0px);
    --st: env(safe-area-inset-top, 0px);
    --sb: env(safe-area-inset-bottom, 0px);
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #000;
    color: var(--bone);
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    font-family: ui-monospace, "Courier New", monospace;
}

body {
    position: fixed;
    inset: 0;
}

::-webkit-scrollbar {
    display: none;
}

#app {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: #000;
}

#app canvas {
    position: absolute;
    display: block;
    background: #000;
    outline: none;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    touch-action: none;
}

/* ------------------------------------------------------------------ touch controls */

.tc-root {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.tc-ui {
    position: absolute;
    inset: 0;
}

.tc-root[data-mode="hidden"] .tc-ui {
    display: none;
}

.tc-root[data-mode="menu"] .tc-play,
.tc-root[data-mode="hidden"] .tc-play {
    display: none !important;
}

.tc-menu-only {
    display: none !important;
}

.tc-root[data-mode="menu"] .tc-menu-only {
    display: flex !important;
}

.tc-btn {
    position: absolute;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--soot);
    border: 1.5px solid var(--bone-dim);
    box-shadow:
        inset 0 0 0 3px rgba(0, 0, 0, 0.35),
        0 0 6px rgba(0, 0, 0, 0.6);
    color: var(--bone);
    opacity: 0.82;
    pointer-events: auto;
    touch-action: none;
    transition:
        transform 60ms ease-out,
        background-color 60ms,
        border-color 60ms,
        opacity 60ms;
}

.tc-btn svg {
    width: 46%;
    height: 46%;
    display: block;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.8));
}

.tc-cap {
    margin-top: 0.4vmin;
    font-size: max(8px, 1.9vmin);
    letter-spacing: 0.12em;
    line-height: 1;
    color: var(--bone-dim);
}

.tc-btn.pressed {
    transform: scale(0.9);
    background: var(--soot-press);
    border-color: var(--ember);
    color: #f4d6a8;
    opacity: 1;
    box-shadow:
        inset 0 0 0 3px rgba(0, 0, 0, 0.3),
        0 0 10px rgba(232, 154, 74, 0.45);
}

/* right cluster (sizes in vmin so it scales with the short side of a landscape screen) */
.tc-cluster {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.tc-attack {
    width: 23vmin;
    height: 23vmin;
    right: calc(24vmin + var(--sr));
    bottom: calc(4vmin + var(--sb));
    border-width: 2px;
}

.tc-jump {
    width: 19vmin;
    height: 19vmin;
    right: calc(3vmin + var(--sr));
    bottom: calc(7vmin + var(--sb));
}

.tc-dodge {
    width: 15vmin;
    height: 15vmin;
    right: calc(5vmin + var(--sr));
    bottom: calc(29vmin + var(--sb));
}

.tc-parry {
    width: 15vmin;
    height: 15vmin;
    right: calc(28vmin + var(--sr));
    bottom: calc(30vmin + var(--sb));
}

.tc-heal {
    width: 12vmin;
    height: 12vmin;
    right: calc(49vmin + var(--sr));
    bottom: calc(5vmin + var(--sb));
}

/* contextual interact: a pill above the cluster */
.tc-interact {
    display: none;
    flex-direction: row;
    gap: 1vmin;
    right: calc(12vmin + var(--sr));
    bottom: calc(48vmin + var(--sb));
    height: 11vmin;
    min-width: 22vmin;
    padding: 0 3vmin;
    border-radius: 6vmin;
    border-color: var(--ember);
    background: rgba(40, 20, 10, 0.55);
}

.tc-interact.show {
    display: flex;
}

.tc-interact svg {
    width: 5vmin;
    height: 5vmin;
    color: var(--ember);
}

.tc-label {
    font-size: max(10px, 3.2vmin);
    letter-spacing: 0.14em;
    color: var(--bone);
}

/* small top buttons */
.tc-small {
    width: 9vmin;
    height: 9vmin;
    top: calc(3vmin + var(--st));
    opacity: 0.7;
}

.tc-pause {
    right: calc(3vmin + var(--sr));
}

.tc-bag {
    right: calc(14vmin + var(--sr));
}

.tc-back {
    left: calc(3vmin + var(--sl));
}

/* floating stick */
.tc-stick-zone {
    position: absolute;
    left: 0;
    top: 16vmin;
    bottom: 0;
    width: 40%;
    pointer-events: auto;
    touch-action: none;
}

.tc-stick-base {
    position: absolute;
    left: calc(17vmin + var(--sl));
    top: calc(100% - 17vmin - var(--sb));
    width: 24vmin;
    height: 24vmin;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    box-sizing: border-box;
    background: rgba(8, 6, 6, 0.3);
    border: 1.5px solid rgba(216, 208, 192, 0.3);
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 120ms;
}

.tc-stick-zone.active .tc-stick-base {
    opacity: 0.95;
    border-color: var(--bone-dim);
    transition: none;
}

.tc-stick-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10vmin;
    height: 10vmin;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    box-sizing: border-box;
    background: rgba(216, 208, 192, 0.18);
    border: 1.5px solid var(--bone);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.7);
}

.tc-stick-zone.active .tc-stick-knob {
    background: rgba(232, 154, 74, 0.22);
    border-color: var(--ember);
}

/* portrait lock screen */
.tc-rotate {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5vmin;
    background: #000;
    color: var(--bone);
    pointer-events: auto;
    z-index: 2;
}

.tc-rotate.show {
    display: flex;
}

.tc-rotate-icon {
    width: 26vmin;
    height: 26vmin;
    animation: tc-rotate 2.4s ease-in-out infinite;
}

.tc-rotate-icon svg {
    width: 100%;
    height: 100%;
}

.tc-rotate-text {
    font-size: max(12px, 4vmin);
    letter-spacing: 0.3em;
    text-align: center;
    padding: 0 6vmin;
}

@keyframes tc-rotate {
    0%,
    25% {
        transform: rotate(0deg);
    }
    55%,
    100% {
        transform: rotate(-90deg);
    }
}
