:root {
    --bg: #f6f3ec;
    --text: #1b1f30;
    --text-soft: rgba(27, 31, 48, .72);
    --muted: rgba(27, 31, 48, .42);
    --tint-a: .34;
    --tint-b: .08;
    --glass-edge: rgba(255, 255, 255, .8);
    --glass-rim: rgba(255, 255, 255, .95);
    --glass-rim-low: rgba(255, 255, 255, .35);
    --glass-glow: rgba(255, 255, 255, .35);
    --glass-sheen: rgba(255, 255, 255, .35);
    --glass-shadow: 0 12px 40px rgba(28, 40, 96, .14), 0 2px 8px rgba(28, 40, 96, .08);
    --chip: rgba(255, 255, 255, .4);
    --chip-hover: rgba(255, 255, 255, .7);
    --chip-edge: rgba(27, 31, 48, .1);
    --accent: #2a5fe6;
    --accent-soft: rgba(42, 95, 230, .12);
    --accent-edge: rgba(42, 95, 230, .35);
    --thumb: rgba(255, 255, 255, .85);
    --focus: rgba(42, 95, 230, .28);
    color-scheme: light
}

[data-theme=dark] {
    --bg: #06070c;
    --text: #e8ebf7;
    --text-soft: rgba(232, 235, 247, .72);
    --muted: rgba(232, 235, 247, .4);
    --tint-a: .1;
    --tint-b: .03;
    --glass-edge: rgba(255, 255, 255, calc(.14 * var(--edge, 1)));
    --glass-rim: rgba(255, 255, 255, calc(.32 * var(--edge, 1)));
    --glass-rim-low: rgba(255, 255, 255, calc(.08 * var(--edge, 1)));
    --glass-glow: rgba(140, 170, 255, .07);
    --glass-sheen: rgba(255, 255, 255, .1);
    --glass-shadow: 0 16px 48px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
    --chip: rgba(255, 255, 255, .05);
    --chip-hover: rgba(255, 255, 255, .12);
    --chip-edge: rgba(255, 255, 255, .1);
    --accent: #7aa2ff;
    --accent-soft: rgba(122, 162, 255, .14);
    --accent-edge: rgba(122, 162, 255, .4);
    --thumb: rgba(255, 255, 255, .14);
    --focus: rgba(122, 162, 255, .3);
    --title-from: #ffffff;
    --title-to: #9b9b9b;
    --title-glow: .3;
    --pond: #06070c;
    color-scheme: dark
}

html,
body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    overflow: hidden
}

body {
    font-family: Geist, ui-sans-serif, system-ui, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased
}

canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    font-family: Geist Mono, ui-monospace, Menlo, monospace;
    touch-action: none
}

button {
    font: inherit;
    color: inherit
}

svg {
    display: block
}

.glass {
    position: fixed;
    isolation: isolate;
    background: linear-gradient(135deg, rgba(255, 255, 255, calc(var(--tint-a) * var(--tint, 1))), rgba(255, 255, 255, calc(var(--tint-b) * var(--tint, 1))));
    border: 1px solid var(--glass-edge);
    box-shadow: inset 1px 1px 0 var(--glass-rim), inset -1px -1px 0 var(--glass-rim-low), inset 0 0 24px var(--glass-glow), var(--glass-shadow);
    -webkit-backdrop-filter: blur(var(--blur, 6px)) saturate(180%);
    backdrop-filter: blur(var(--blur, 6px)) saturate(180%);
    transition: background .4s, border-color .4s, box-shadow .4s
}

.liquid .glass {
    -webkit-backdrop-filter: url(#liquid-glass) blur(var(--blur, 6px)) saturate(180%);
    backdrop-filter: url(#liquid-glass) blur(var(--blur, 6px)) saturate(180%)
}

.glass:after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(180deg, var(--glass-sheen), transparent 48%);
    pointer-events: none
}

.top-bar {
    position: fixed;
    z-index: 30;
    top: 18px;
    left: 50%;
    translate: -50% 0;
    display: none;
    align-items: center;
    gap: 8px
}

body.tweaks-visible .top-bar {
    display: flex
}

.top-bar .glass {
    position: relative
}

.choices {
    display: flex;
    gap: 2px;
    max-width: max(240px, calc(100vw - 300px));
    padding: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    border-radius: 999px;
    --blur: 5px
}

.choices::-webkit-scrollbar {
    display: none
}

.choices button {
    position: relative;
    z-index: 1;
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 13px 0 11px;
    border: 0;
    border-radius: 999px;
    background: none;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    transition: color .3s
}

.choices button:hover {
    color: var(--text-soft)
}

.choices button[aria-checked=true] {
    color: var(--text)
}

.choices button:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: -2px
}

.choices .thumb {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 0;
    border-radius: 999px;
    background: var(--thumb);
    box-shadow: inset 0 1px 0 var(--glass-rim), 0 2px 8px #0000001f;
    transition: translate .35s cubic-bezier(.3, 1.3, .5, 1), width .35s cubic-bezier(.3, 1.3, .5, 1)
}

.choices .dot {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--swatch) 50%, white), var(--swatch) 70%)
}

.ascii-clock-wrap {
    position: fixed;
    top: 24px;
    left: 30px;
    z-index: 20;
    pointer-events: none;
    transform: scale(0.6);
    transform-origin: top left;
}

.ascii-ampm {
    position: absolute;
    left: calc(100% + 10px);
    top: 0
}

.mark-glow {
    position: absolute;
    z-index: 19;
    pointer-events: none;
    filter: blur(14px)
}

.top-layout {
    position: fixed;
    top: 20px;
    left: 50%;
    translate: -50% 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    transition: translate .35s cubic-bezier(.3, 1.3, .5, 1)
}

body.tweaks-visible .top-layout {
    translate: -50% 56px
}

.stage {
    position: fixed;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    display: flex;
    flex-direction: column;
    align-items: center
}

.masthead {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    pointer-events: none
}

.logo {
    --logo-texture: .62;
    position: relative;
    width: 76px;
    aspect-ratio: 159 / 129;
    -webkit-mask: url(../dia-logo.png) center / contain no-repeat;
    mask: url(../dia-logo.png) center / contain no-repeat;
    background: linear-gradient(180deg, #ffffff1a, #ffffff05);
    -webkit-backdrop-filter: blur(6px) saturate(160%);
    backdrop-filter: blur(6px) saturate(160%)
}

.liquid .logo {
    -webkit-backdrop-filter: url(#liquid-glass) blur(6px) saturate(160%);
    backdrop-filter: url(#liquid-glass) blur(6px) saturate(160%)
}

.logo:before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: url(../dia-logo.png) center / contain no-repeat;
    opacity: var(--logo-texture)
}

.greeting {
    margin: 0;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, SF Pro Display, Geist, system-ui, sans-serif;
    font-size: clamp(24px, 5vw, 32px);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -.02em;
    color: #e8e8e8;
    text-shadow: 0 0 6px var(--bg), 0 0 24px var(--bg)
}

.searchbar {
    --glass-rim: rgba(255, 255, 255, calc(.14 * var(--edge, 1)));
    --glass-sheen: rgba(255, 255, 255, .04);
    position: relative;
    width: min(440px, calc(100vw - 32px));
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 48px;
    margin: 0;
    padding: 0 18px;
    border-radius: 24px;
    --blur: 7px;
    font-family: -apple-system, BlinkMacSystemFont, SF Pro Text, Geist, system-ui, sans-serif
}

.searchbar:focus-within {
    border-color: rgba(122, 162, 255, calc(.3 * var(--edge, 1)));
    box-shadow: inset 1px 1px 0 var(--glass-rim), inset -1px -1px 0 var(--glass-rim-low), inset 0 0 24px var(--glass-glow), 0 0 0 3px rgba(122, 162, 255, calc(.12 * var(--edge, 1))), var(--glass-shadow)
}

.search-g {
    flex: none
}

.searchbar input {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: none;
    background: none;
    font-family: inherit;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.4;
    color: #ececec;
    caret-color: #ececec
}

.searchbar input::placeholder {
    color: #8d8d8d
}

.shortcuts {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
    margin: 0
}

.shortcut {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 72px;
    text-decoration: none;
    color: #e8e8e8eb
}

.shortcut-tile {
    position: relative;
    box-sizing: border-box;
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: #ffffff40;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: background .2s
}

.shortcut-tile:before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(156.52deg, #0000000d 2.12%, #0000 39%, #0000 54.33%, #00000026 93.02%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    pointer-events: none
}

.shortcut:hover .shortcut-tile {
    background: #ffffff59
}

.shortcut-tile img {
    position: relative;
    z-index: 1;
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 8px
}

.shortcut-letter {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    place-items: center;
    font-family: Geist, system-ui, sans-serif;
    font-size: 26px;
    font-weight: 600;
    color: #ffffffd9
}

.shortcut-label {
    max-width: 72px;
    height: 17px;
    padding: 0 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 400;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6)
}

.shortcut-menu {
    position: fixed;
    z-index: 100;
    min-width: 180px;
    padding: 6px;
    border-radius: 12px;
    background: #1c1c1e;
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 8px 24px #00000080;
    font-family: Geist, system-ui, sans-serif
}

.shortcut-menu[hidden] {
    display: none
}

.shortcut-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #f2f2f2;
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer
}

.shortcut-menu-item:hover {
    background: #ffffff1a
}

.shortcut-menu-item svg {
    flex: none;
    color: #fffc
}

.edit-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    background: #00000080
}

.edit-overlay[hidden] {
    display: none
}

.edit-dialog {
    width: min(360px, calc(100vw - 32px));
    padding: 20px;
    border-radius: 16px;
    background: #1e1e22f7;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 16px 48px #00000080;
    color: #ececec;
    font-family: Geist, system-ui, sans-serif
}

.edit-dialog h2 {
    margin: 0 0 16px;
    font-size: 17px;
    font-weight: 600
}

.edit-dialog label {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
    color: #ecececbf
}

.edit-dialog input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 6px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, .15);
    background: #ffffff12;
    color: #ececec;
    font: inherit;
    font-size: 14px;
    outline: none
}

.edit-dialog input:focus {
    border-color: #fff6
}

.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px
}

.edit-actions button {
    padding: 8px 16px;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer
}

.edit-cancel {
    border: 1px solid rgba(255, 255, 255, .2);
    background: transparent;
    color: #ececec
}

.edit-save {
    border: 0;
    background: #ececec;
    color: #111
}

.tweaks {
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 288px;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    font-size: 12px;
    --blur: 18px;
    --tint-a: .62;
    --tint-b: .48
}

[data-theme=dark] .tweaks {
    --tint-a: .1;
    --tint-b: .06
}

[data-theme=dark] .tweaks,
[data-theme=dark] .tweaks-open {
    background-color: #0a0c148c
}

.liquid .tweaks {
    -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
    backdrop-filter: blur(var(--blur)) saturate(180%)
}

.tweaks[hidden],
.tweaks-open[hidden] {
    display: none
}

.tweaks-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 10px 10px 16px;
    border-bottom: 1px solid var(--chip-edge)
}

.tweaks-head h2 {
    flex: 1;
    margin: 0;
    font-size: 13px;
    font-weight: 500
}

.tweaks-action,
.tweaks-close {
    height: 26px;
    border: 1px solid var(--chip-edge);
    border-radius: 999px;
    background: var(--chip);
    color: var(--text-soft);
    cursor: pointer;
    font-size: 12px
}

.tweaks-action {
    padding: 0 10px
}

.tweaks-action.confirm {
    color: #ff9a9a;
    background: #ff5a5a24;
    border-color: #ff787873
}

.tweaks-action.confirm:hover {
    color: #ffb4b4;
    background: #ff5a5a38
}

.tweaks-close {
    width: 26px;
    padding: 0;
    display: grid;
    place-items: center
}

.tweaks-action:hover,
.tweaks-close:hover {
    background: var(--chip-hover);
    color: var(--text)
}

.tweaks-body {
    overflow-y: auto;
    padding: 4px 16px 14px;
    overscroll-behavior: contain
}

.tweaks-group h3 {
    margin: 14px 0 6px;
    font: 600 10px/1 Geist Mono, ui-monospace, monospace;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted)
}

.tweaks-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 8px;
    padding: 4px 0;
    color: var(--text-soft)
}

.tweaks-row.off {
    opacity: .4
}

.tweaks-label {
    cursor: default;
    -webkit-user-select: none;
    user-select: none
}

.tweaks-tip {
    position: fixed;
    z-index: 40;
    max-width: 240px;
    padding: 9px 11px;
    border: 1px solid var(--glass-edge);
    border-radius: 12px;
    background: #0e101aeb;
    box-shadow: var(--glass-shadow);
    font-size: 12px;
    line-height: 1.45;
    color: var(--text);
    pointer-events: none
}

.tweaks-tip[hidden] {
    display: none
}

.tweaks-tip small {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--muted)
}

.tweaks-value {
    font: 600 11px Geist Mono, ui-monospace, monospace;
    color: var(--text)
}

.tweaks-row input[type=range] {
    grid-column: 1 / -1
}

.tweaks input[type=range] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    height: 18px;
    margin: 2px 0 0;
    background: transparent;
    cursor: pointer
}

.tweaks input[type=range]:disabled {
    cursor: default
}

.tweaks input[type=range]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, var(--accent) var(--fill, 50%), var(--chip-edge) var(--fill, 50%))
}

.tweaks input[type=range]::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: var(--chip-edge)
}

.tweaks input[type=range]::-moz-range-progress {
    height: 4px;
    border-radius: 2px;
    background: var(--accent)
}

.tweaks input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .12);
    box-shadow: 0 1px 4px #0003
}

.tweaks input[type=range]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .12);
    box-shadow: 0 1px 4px #0003
}

.tweaks input:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-radius: 4px
}

.tweaks input[type=checkbox] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: relative;
    width: 30px;
    height: 18px;
    margin: 0;
    border-radius: 999px;
    background: var(--chip-edge);
    cursor: pointer;
    transition: background .2s
}

.tweaks input[type=checkbox]:after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px #00000040;
    transition: translate .2s
}

.tweaks input[type=checkbox]:checked {
    background: var(--accent)
}

.tweaks input[type=checkbox]:checked:after {
    translate: 12px 0
}

.tweaks-open {
    bottom: 20px;
    right: 20px;
    z-index: 10;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    color: var(--text-soft);
    cursor: pointer;
    --blur: 10px
}

.liquid .tweaks-open {
    -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
    backdrop-filter: blur(var(--blur)) saturate(180%)
}

.tweaks-open:hover {
    color: var(--text)
}

@media(max-width:520px) {
    .pill span {
        display: none
    }

    .pill {
        padding: 0 9px
    }
}

@media(max-width:720px) {
    .top-bar {
        top: max(12px, env(safe-area-inset-top));
        left: 12px;
        right: 12px;
        translate: none;
        justify-content: center
    }

    .choices {
        max-width: 100%
    }

    .tweaks-open {
        bottom: max(12px, env(safe-area-inset-bottom));
        right: 12px
    }

    .tweaks {
        top: auto;
        bottom: 12px;
        left: 12px;
        right: 12px;
        width: auto;
        max-height: 70vh
    }
}

@media(prefers-reduced-motion:reduce) {

    .glass,
    .choices .thumb,
    .choices button,
    .send,
    .pill,
    .icon-btn {
        transition: none
    }
}