* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: white;
    position: relative;
    width: 100vw;
    min-height: 100vh;
    font-family: "helvetica-lt-pro", sans-serif;
    font-weight: 400;
    font-style: normal;
}




#dropdown-box {
    position: absolute;
    left: calc(50% + 3px);
    top: calc(50% + 118px);
}

#memory-wrapper {
    position: absolute;
    left: calc(50% + 3px);
    top: calc(50% + 164px);
}

#calc {
    position: absolute;
    left: calc(50% + 3px - 116px - 14px);
    top: calc(50% + 118px + 26px + 20px);
}

#circle-control {
    position: absolute;
    left: calc(50% + 3px - 116px - 14px);
    top: calc(50% + 118px + 26px + 20px - 80px);
}

#catch-wrapper {
    position: absolute;
    left: calc(50% - 133px - 176px - 12px);
    top: calc(50% + 84px);
}

#grid {
    position: absolute;
    left: calc(50% - 123px - 173px - 4px);
    top: calc(50% - 60px);
}

#box {
    position: absolute;
    left: calc(50% - 123px - 173px - 4px - 176px - 15px);
    top: calc(50% - 115px);
}

.snakegame {
    position: absolute;
    left: calc(50% - 123px - 176px + 15px);
    top: calc(50% - 255px);
}


#rotary-svg {
    position: absolute;
    left: calc(50% + 115px);
    top: calc(50% - 65px);
}

#btn-control {
    position: absolute;
    left: calc(50% + 115px);
    top: calc(50% - 65px - 20px);
    z-index: 10;
}

#spin-widget {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ---- play/pause ---- */

#play-pause {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: none;
    border: none;
    font-size: 40px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    z-index: 10;
    background: linear-gradient(135deg, #f331a8, #9138e4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    -webkit-text-stroke: 2px black;
    filter: url(#grain);
}


/* ---- linear circles ---- */

.slider {
    position: absolute;
    left: calc(50% + 260px + 13px);
    top: calc(50% - 355px);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    z-index: 10;
}

.arrow {
    background: none;
    border: none;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.circles {
    display: flex;
    flex-direction: column-reverse;
    gap: 3px;
}

.circle {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 2px solid black;
    background: white;
    transition: background 0.25s ease, transform 0.2s ease;
}

.circle.filled {
    background: black;
    transform: scale(1.1);
}


/* ---- gird of circles ---- */

#grid {
    display: grid;
    grid-template-columns: repeat(11, 13px);
    gap: 3px;
    flex-shrink: 0;
}

.cell {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 2px solid black;
    background: white;
    cursor: pointer;
}

.cell.on {
    background: black;
}


/* ---- scroll picker ---- */

#picker {
    position: absolute;
    left: calc(50% + 3px + 198px - 1px);
    top: calc(50% + 138px);
    display: flex;
    gap: 12px;
    align-items: stretch;
    flex-shrink: 0;
}

#picker-list {
    width: 126px;
    height: 179px;
    overflow: hidden;
    border: 2px solid black;
    position: relative;
}

.picker-item {
    position: absolute;
    font-weight: bold;
    line-height: 1;
    font-size: 18px;
    color: rgb(255, 255, 255);
    width: 100%;
    text-align: center;
    transform: translateY(-50%);
    transition: font-size 0.15s, color 0.15s, opacity 0.15s, top 0.15s;
}

.picker-item.current {
    font-size: 36px;
    color: black;
}

.picker-item.hidden {
    opacity: 0;
}

#picker-track {
    position: absolute;
    right: 4px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: #ffffff;
    border-radius: 1px;
}

#picker-thumb {
    width: 2px;
    background: black;
    position: absolute;
    top: 0;
    height: 40px;
    border-radius: 1px;
    transition: top 0.1s;
}


/* ---- random circles ---- */

#box {
    position: absolute;
    width: 176px;
    height: 179px;
    border: 2px solid black;
    flex-shrink: 0;
}

.dot {
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid black;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}

#refresh {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

/* ---- circle control ---- */

#cc-track-ring {
    fill: none;
    stroke: #ffffff;
    stroke-width: 5.5;
}

#cc-fill-ring {
    fill: none;
    stroke: black;
    stroke-width: 5.5;
    stroke-linecap: round;
    transform-box: fill-box;
    transform-origin: center;
    transform: rotate(-90deg);
}

#cc-handle {
    fill: black;
    cursor: grab;
}

#cc-handle:active {
    cursor: grabbing;
}


/* ---- rotary dial ---- */

#rotary-svg {
    flex-shrink: 0;
    cursor: default;
}

#rotary-disk {
    transform-origin: 140px 140px;
}

.rotary-digit {
    cursor: pointer;
}

.rotary-hole {
    fill: white;
    stroke: black;
    stroke-width: 2.9;
}

.rotary-digit.selected .rotary-hole {
    fill: black;
}

.rotary-label {
    fill: black;
    font-size: 13px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

.rotary-digit.selected .rotary-label {
    fill: white;
}


/* ---- snake game---- */

.snakegame {
    flex-shrink: 0;
}

#snake-refresh {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: none;
    border: none;
    font-size: 11px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

#board {
    display: grid;
    grid-template-columns: repeat(17, 1fr);
    grid-template-rows: repeat(17, 1fr);
    border: 2px solid black;
    width: 176px;
    height: 179px;
}

.snake-cell {
    background: white;
}

.snake-cell.snake {
    background: black;
    border-radius: 50%;
}

.snake-cell.food {
    background: white;
    border: 2px solid black;
    border-radius: 50%;
    box-sizing: border-box;
}


/* ---- calculator ---- */

#calc {
    flex-shrink: 0;
    border: 2px solid black;
    border-radius: 14px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 116px;
}

#calc-display {
    border: 2px solid black;
    border-radius: 8px;
    padding: 4px 6px;
    font-size: 13px;
    font-weight: bold;
    text-align: right;
    min-height: 60px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

#calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 22px);
    gap: 3px;
}

#calc-buttons button {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid black;
    background: white;
    font-size: 9px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
}


/* ---- tube ---- */

#tube {
    width: 8px;
    height: 179px;
    border: 2px solid black;
    border-radius: 4px;
    position: absolute;
    left: calc(50% - 133px - 176px - 12px - 8px - 13px);
    top: calc(50% + 82px);
    overflow: hidden;
    cursor: pointer;
}

#tube-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: black;
    border-radius: 0 0 10px 10px;
    transition: height 0.1s;
}


/* ---- button control ---- */

#btn-control {
    display: flex;
    flex-direction: column;
    border: 2px solid black;
    border-radius: 14px;
    overflow: hidden;
    flex-shrink: 0;
    width: 24px;
}

#btn-control button {
    width: 100%;
    height: 21px;
    background: none;
    border: none;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
}





/* ---- scale ---- */

#scale-box {
    position: absolute;
    left: calc(50% - 14px + 176px - 78px);
    top: calc(50% - 134px - 164px - 27px);
    width: 176px;
    height: 179px;
    border: 2px solid black;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
}

#scale-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: black;
    pointer-events: none;
}


/* ---- memory game ---- */

#memory-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    flex-shrink: 0;
}

#memory-game {
    flex-shrink: 0;
}

#memory-refresh {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    color: black;
}

#memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 42px);
    grid-template-rows: repeat(3, 62px);
    gap: 4px;
}

.mem-card {
    border-radius: 8px;
    background: black;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    transition: background 0.2s, color 0.2s, border 0.2s;
}

.mem-card.flipped {
    background: white;
    color: black;
    border: 2px solid black;
}

.mem-card.matched {
    background: white;
    color: black;
    border: 2px solid black;
}


/* ---- 2048 ---- */

#start-2048 {
    width: fit-content;
    background: none;
    border: 2px solid black;
    font-size: 11px;
    font-weight: bold;
    font-family: "helvetica-lt-pro", sans-serif;
    letter-spacing: 2px;
    cursor: pointer;
    padding: 0 2px;
    margin-bottom: 10px;
    text-align: left;
}


#game-2048 {
    position: absolute;
    left: calc(50% - 82px - 10px);
    top: calc(50% - 134px - 164px - 27px);
    border: 2px solid black;
    border-radius: 10px;
    padding: 6px;
    flex-shrink: 0;
    width: 164px;
}

#grid-2048 {
    position: relative;
    width: 148px;
    height: 148px;
}

.bg-cell-2048 {
    position: absolute;
    left: 0;
    top: 0;
    width: 35px;
    height: 35px;
    border: 2px solid black;
    border-radius: 6px;
}

.tile-2048 {
    position: absolute;
    left: 0;
    top: 0;
    width: 35px;
    height: 35px;
    border-radius: 6px;
    background: black;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.12s ease;
    z-index: 1;
}

.tile-2048.negative {
    background: white;
    color: black;
    border: 2px solid black;
}


/* ---- catch game ---- */

#catch-box {
    width: 176px;
    height: 171px;
    border: 2px solid black;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

#catch-bucket {
    position: absolute;
    bottom: 6px;
    width: 44px;
    height: 24px;
    border-left: 2px solid black;
    border-right: 2px solid black;
    border-bottom: 2px solid black;
}

.catch-ball {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid black;
    background: white;
}

.catch-ball.filled {
    background: black;
}

#catch-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#catch-scrollbar {
    width: 176px;
    height: 2px;
    background: #ffffff;
    border-radius: 1px;
    position: relative;
    cursor: pointer;
}

#catch-thumb {
    position: absolute;
    top: 0;
    height: 2px;
    width: 44px;
    background: black;
    border-radius: 1px;
    cursor: grab;
}

#catch-thumb:active {
    cursor: grabbing;
}





/* ---- slot machine ---- */

#slot-machine {
    position: absolute;
    left: calc(50% - 123px - 173px - 4px - 176px - 48px);
    top: calc(50% - 115px - 157px - 18px);
    display: flex;
    align-items: center;
}

#slot-reels {
    display: flex;
    gap: 8px;
}

.slot-reel {
    width: 55px;
    height: 157px;
    border: 2px solid black;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-num {
    font-size: 48px;
    font-weight: bold;
    line-height: 1;
}

#slot-lever-svg {
    cursor: pointer;
}

#slot-lever-arm {
    transform-origin: 13px 146px;
}


/* ---- knob ---- */

#knob-svg {
    position: absolute;
    left: calc(50% + 200px + 140px - 18px);
    top: calc(50% + 138px);
    flex-shrink: 0;
}

.knob-dot {
    fill: black;
}

#knob-body {
    fill: white;
    stroke: black;
    stroke-width: 3.1;
    cursor: grab;
}

#knob-body:active {
    cursor: grabbing;
}



/* ---- low med high ---- */

#lmh {
    position: absolute;
    left: calc(50% - 491px + 88px - 62px - 72px);
    top: calc(50% - 115px + 179px + 22px);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.lmh-btn {
    width: 53px;
    height: 51px;
    border-radius: 50%;
    border: 2px solid black;
    background: white;
    color: black;
    font-size: 12px;
    font-family: "helvetica-lt-pro", sans-serif;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.lmh-btn.active {
    background: black;
    color: white;
}


/* ---- dice ---- */

#dice-svg {
    position: absolute;
    left: calc(50% - 537px + 62px - 42px + 72px);
    top: calc(50% + 86px + 51px + 22px);
    flex-shrink: 0;
    cursor: pointer;
}

.die-dot {
    fill: black;
    display: none;
}

.die-dot.show {
    display: block;
}

#dice-svg.rolling rect {
    animation: dice-shake 0.12s ease infinite;
    transform-origin: 90px 90px;
}

@keyframes dice-shake {
    0%, 100% { transform: rotate(0deg); }
    25%       { transform: rotate(-4deg); }
    75%       { transform: rotate(4deg); }
}


/* ---- resize box ---- */

#resize-outer {
    position: absolute;
    left: calc(50% + 322px + 25px);
    top: calc(50% + 138px - 179px + 10px);
    width: 176px;
    height: 179px;
    border: 2px solid black;
    flex-shrink: 0;
}

#resize-inner {
    position: absolute;
    background: black;
    top: 10px;
    left: 10px;
    width: 80px;
    height: 80px;
}


/* ---- click counter circle ---- */

#click-circle {
    position: absolute;
    left: calc(50% + 115px + 196px - 37px + 16px);
    top: calc(50% - 65px + 190px - 37px);
    width: 37px;
    height: 37px;
    border-radius: 50%;
    border: 2px solid black;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
}

#click-count {
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
}


/* ---- stopwatch ---- */

#stopwatch-widget {
    position: absolute;
    left: calc(50% + 347px + 88px - 175px);
    top: calc(50% - 31px - 259px + 18px);
    flex-shrink: 0;
}

#sw-btn {
    cursor: pointer;
}

#sw-hand-group {
    transform-origin: 140px 148px;
}


/* ---- gradient picker ---- */

#gradient-box {
    position: absolute;
    left: calc(50% + 84px + 88px - 90px);
    top: calc(50% - 325px + 179px + 20px);
    width: 179px;
    height: 24px;
    background: linear-gradient(to right, white, black);
    border: 2px solid black;
    flex-shrink: 0;
    cursor: crosshair;
}

#gradient-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    background: black;
    transform: translate(-50%, -50%);
    pointer-events: none;
    left: 50%;
    top: 50%;
    mix-blend-mode: difference;
}


/* ---- spin wheel ---- */

#spin-widget {
    flex-shrink: 0;
}

#spin-wheel {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 3s cubic-bezier(0.17, 0.67, 0.12, 1);
}

#spin-wheel path {
    fill: white;
    stroke: black;
    stroke-width: 2;
}

#spin-wheel text {
    font-size: 16px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

#spin-pointer {
    fill: black;
}

#spin-center {
    fill: black;
    cursor: pointer;
}

#spin-label {
    fill: white;
    font-size: 11px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}


/* ---- dropdown ---- */

#dropdown-box {
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
}

#vol-dropdown {
    width: 120px;
    position: relative;
    font-family: "helvetica-lt-pro", sans-serif;
    font-weight: 300;
    font-size: 11px;
}

#vol-selected {
    border: 2px solid black;
    padding: 0 6px;
    height: 26px;
    background: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    text-align: left;
}

#vol-chevron {
    font-size: 11px;
}

#vol-options-wrap {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border: 2px solid black;
    border-top: none;
    background: white;
    z-index: 20;
    max-height: 200px;
    overflow: hidden;
}

#vol-options-wrap.open {
    display: block;
}

#vol-options {
    width: 100%;
    max-height: 200px;
    overflow-y: scroll;
    scrollbar-width: none;
}

#vol-options::-webkit-scrollbar {
    display: none;
}

#vol-scroll-track {
    width: 2px;
    background: white;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
}

#vol-scroll-thumb {
    width: 2px;
    background: black;
    position: absolute;
    top: 0;
    border-radius: 1px;
    transition: top 0.05s;
}

#vol-options.open {
    display: block;
}

.vol-option {
    padding: 8px 16px;
    cursor: pointer;
}

.vol-option:hover {
    background: black;
    color: white;
}


/* ---- type box ---- */

#type-box {
    position: absolute;
    left: calc(50% - 284px + 88px - 60px + 27px);
    top: calc(50% - 255px - 26px - 22px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    flex-shrink: 0;
}

#type-input {
    width: 120px;
    height: 26px;
    border: 2px solid black;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 300;
    font-family: "helvetica-lt-pro", sans-serif;
    outline: none;
    text-align: left;
    background: white;
}

#type-input.error {
    border-color: black;
    animation: type-shake 0.4s ease;
}

#type-error {
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

#type-error.visible {
    opacity: 1;
}

@keyframes type-shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}
