/* AutoBuyer+ interface: a copy of the extension's src/toolbar/layout.css (AutoBuyerPlus-Source),
   so the site looks and behaves exactly like the extension. Keep it in sync by copying the extension's
   file again (asset paths point at resources/). Site-only styles live in site.css; */

@font-face {
    font-family: 'Cabin Condensed';
    src: local('Cabin Condensed'), url('resources/Cabin Condensed.ttf') format('truetype');
}

:root {
    --tooth-space: 1.25;
    --tooth-y: 2vh;
    --screen: calc(6.103vw + 10.807vh);
    --screen-scale: calc(var(--screen) / 2);
    --rest-color: white;
    --hover-color: #b8e9fc;
    --bounciness: 1.5;
    --switch-height: 4vh;
    --switch-width: calc(var(--switch-height) * 2.3);
    --slider-color: #ccc;
    --slider-knob-size: calc(var(--switch-height) - 8px);
    --slider-knob-offset: 4px;
}

html, body{
    height: 100%;
    font-family: "Cabin Condensed";
}

body{
    background-color: white;
    overflow: hidden;
}

a{
    text-decoration: none;
}

.text{
    font-size: calc(var(--screen) / 9); /* calc / 8 = 1.3*/
    color: white;
}

/*////////////////////////////////////////////////////////////////////////*/

#update-screen::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: radial-gradient(#ff515f 60%, #e31e2e);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 7;
}

.update {
    z-index: 9;
}

#update-gradient {
    background: radial-gradient(circle, transparent 75%, #c40d1d);
}

.update-icon {
    position: absolute;
    width: 30%;
    height: 10vw;
    top: 50%;
    transform: translate(0%, -50%);
}

#update-title {
    position: relative;
    font-size: calc(var(--screen) / 2); /* calc / 8 = 1.3*/
    margin-top: 15vh;
    display: flex;
    justify-content: center;
    margin-bottom: 0px;
}

#update-status {
    display: flex;
    justify-content: center;
    width: 100%;
}

#update-message {
    position: relative;
    padding-left: 25%;
    padding-right: 25%;
}

.update-options {
    position: absolute;
    width: 100%;
    bottom: 15%;
}

.update-button {
    font-size: calc(var(--screen) / 9); /* calc / 8 = 1.3*/
    font-weight: bold;
    color: white;
    background-color: rgba(255, 81, 95, 0.6);
    font-family: "Cabin Condensed" !important;

    transition: width 0.17s ease-in-out, background-color 0.3s ease-in-out, color 0.3s ease-in-out, border 0.3s ease-in-out;
    border: 3px solid white;
    border-radius: 10px;

    width: 300px;
    height: 50px;
    margin: 15px;
}

.update-button:hover {
    background-color: rgba(255, 134, 144, 0.5);
    border: 3px solid #ff515f;
    color: white;
}

.update-image-button {
    position: absolute;
    bottom: 3%;
    left: 1.5%;
    color: white !important;
    background-color: rgba(255, 81, 95, 0.6) !important;
    border: 2px solid white !important;
    width: 3.4vw !important;
    min-width: 32px !important;
    cursor: pointer;
}

.update-image-button:hover {
    width: 20vw !important;
    background-color: rgba(255, 134, 144, 0.5) !important;
    border: 2px solid #ff515f !important;
}

.update-image-button img {
    margin-left: calc(var(--screen) / 140) !important;
    height: calc(var(--screen) / 6) !important;
}

/*////////////////////////////////////////////////////////////////////////*/

#background{
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}

.background-properties{
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    left: 50%;
    translate: -50% 0%;
    opacity: 1;
}

#background-container{
    clip-path: polygon(
        0% 100%, 2.9412% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        5.8824% 100%, 8.8235% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        11.7647% 100%, 14.7059% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        17.6471% 100%, 20.5882% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        23.5294% 100%, 26.4706% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        29.4118% 100%, 32.3529% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        35.2941% 100%, 38.2353% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        41.1765% 100%, 44.1176% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        47.0588% 100%, 50% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        52.9412% 100%, 55.8824% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        58.8235% 100%, 61.7647% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        64.7059% 100%, 67.6471% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        70.5882% 100%, 73.5294% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        76.4706% 100%, 79.4118% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        82.3529% 100%, 85.2941% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        88.2353% 100%, 91.1765% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        94.1176% 100%, 97.0588% calc(100% - (var(--tooth-y) * var(--tooth-space))), 
        100% 100%, 100% 75%, 0% 75%
    );

    translate: -50% -90%;
    pointer-events: none;
    z-index: 5;
}

.navigation-container {
    position: absolute;
    height: 1%;
    width: 0.75%;
    top: 5%;
    transform: translate(-150%, -400%);
    user-select: none;
}

.navigation-container a .navigation-option {
    width: calc(var(--screen) / 5);
    height: auto;
    transition: transform 0.3s ease-in-out;
}

.navigation-container a:hover .navigation-option,
.shortcut-table tr:hover img {
    animation: squishStretchAndRotate 0.3s linear;
    transform: rotate(-20deg);
}

@keyframes squishStretchAndRotate {
    0% {
        transform: rotate(0deg) scaleX(1) scaleY(1);
    }
    20% {
        transform: rotate(-4deg) scaleX(calc(1 + (0.2 * var(--bounciness)))) scaleY(calc(1 - (0.2 * var(--bounciness))));
    }
    40% {
        transform: rotate(-10deg) scaleY(calc(1 + (0.2 * var(--bounciness))));
    }
    60% {
        transform: rotate(-20deg) scaleY(calc(1 - (0.1 * var(--bounciness))));
    }
    80% {
        transform: rotate(-20deg) scaleX(calc(1 - (0.1 * var(--bounciness)))) scaleY(calc(1 + (0.1 * var(--bounciness))));
    }
    100% {
        transform: rotate(-20deg) scaleX(1) scaleY(1);
    }
}

.dropdown-arrow {
    position: absolute;
    width: 1.4vw;
    height: 1.5vh;
    transform: translate(32%, 40%);
    transform-origin: center;
    transition: transform 0.2s ease-in-out;
}

.navigation-container a .navigation-option:hover + .dropdown-arrow {
    transform: translateX(32%, 40%) rotate(-180deg);
}

.neomail-notification {
    position: absolute;
    width: calc(var(--screen) / 15);
    height: auto;
    transform: translate(220%, -170%);
    animation: blink 0.8s infinite;
    pointer-events: none;
}

@keyframes blink{
    0%, 100%{
        opacity: 100%;
    } 50% {
        opacity: 30%;
    }
}

/*////////////////////////////////////////////////////////////////////////*/

.toolbar-category {
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.toolbar-category .dropdown-icon {
    transition: transform 0.2s;
    max-width: calc(var(--screen) / 6.5);
    margin-right: calc(var(--screen) / 18);
}

.toolbar-category:hover img {
    animation: squishStretchAndRotate 0.3s linear;
    transform: rotate(-20deg);
}

.hover-menu, .hover-submenu {
    position: absolute;
    background-color: #48c2f2;
    box-shadow: 0 calc(var(--screen) / 12) calc(var(--screen) / 6.5) rgba(0, 0, 0, 0.1);
    border-radius: calc(var(--screen) / 15);
    z-index: 4;
    flex-direction: column;
    padding: 7px;
    display: none;
}

.hover-menu {
    display: flex;
    flex-direction: column;
    transform: translateX(-50%);
    top: 1vh;
    left: 0px;
}

.hover-menu ul, .hover-submenu ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.hover-menu ul:first-child {
    margin-top: 8vh;
}

.hover-submenu ul:first-child {
    margin-top: 0px;
}

.hover-menu a, .hover-submenu a {
    text-decoration: none;
    color: white;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding: 2.5px 10px;
    margin-left: auto;
    transition: background-color 0.5s;
    border-radius: calc(var(--screen) / 15);
}

.hover-menu a:hover, .hover-submenu a:hover {
    background-color: #2eb2e7;
}

.hover-submenu {
    transform: translateX(10.5vw) translateY(-7px);
}

.hover-menu li:hover .hover-submenu {
    display: flex;
    flex-direction: column;
}

.dropleft-arrow {
    transition: transform 0.3s ease-in-out;
    width: 13px;
    position: absolute;
    transform: rotate(90deg);
    right: 10px;
    transform-origin: center;
    max-width: calc(var(--screen) / 6.5);
}

.hover-menu li:hover .dropleft-arrow {
    transform: rotate(270deg);
    animation: none;
}



/*////////////////////////////////////////////////////////////////////////*/

#background-top {
    background: radial-gradient(#3ac7ff 60%, #1d94c3);
}

#autobuyer-logo {
    position: fixed;
    z-index: 4;
    width: 23vh;
    height: auto;
    left: 0;
    transform: translate(45%, 90.7vh);
    user-select: none;
}

.round-toolbar-button .toolbar-link {
    position: fixed;
    z-index: 5;

    background-color: white;
    border-radius: calc(var(--screen) / 12);
    top: 1vh;
    width: calc(var(--screen) / 4.5);
    height: calc(var(--screen) / 4.5);
    transform: translate(-5%);
    transform-origin: center;

    display: flex;
    justify-content: center;
    align-items: center;
    animation: revert-background 0.2s forwards;
    box-shadow: 0 0 0 0 #1d94c3;
}

@keyframes hover-background {
    from {
        background-color: white;
        box-shadow: 0 0 0 0 #1d94c3;
        z-index: 5;
    }
    to {
        background-color: #b8e9fc;
        box-shadow: 0 0 0 0.2vw #1d94c3;
        z-index: 6;
    }
}

@keyframes revert-background {
    from {
        background-color: #b8e9fc;
        box-shadow: 0 0 0 0.2vw #1d94c3;
        z-index: 5;
    }
    to {
        background-color: white;
        box-shadow: 0 0 0 0 #1d94c3;
        z-index: 6;
    }
}

@keyframes pulse-icon {
    0%, 100% {
        transform: translate(-5%);
        z-index: 7;
    }
    50% {
        transform: translate(-5%) scale(1.15, 1.15);
        z-index: 7;
    }
}

.round-toolbar-button .toolbar-link:hover {
    animation: hover-background 1s forwards, pulse-icon 1.75s ease-in-out infinite;
}

.orange-toolbar-link {
    animation: orange-revert-background 0.2s forwards;
}

.round-toolbar-button .orange-toolbar-link:hover {
    animation: orange-hover-background 1s forwards, pulse-icon 1.75s ease-in-out infinite;
}

@keyframes orange-hover-background {
    from {
        background-color: white;
        box-shadow: 0 0 0 0 #ffbe63;
        z-index: 5;
    }
    to {
        background-color: #ffe7c5;
        box-shadow: 0 0 0 0.2vw #ffbe63;
        z-index: 6;
    }
}

@keyframes orange-revert-background {
    from {
        background-color: #ffe7c5;
        box-shadow: 0 0 0 0.2vw #ffbe63;
        z-index: 5;
    }
    to {
        background-color: white;
        box-shadow: 0 0 0 0 #ffbe63;
        z-index: 6;
    }
}

.round-toolbar-button .toolbar-link img {
    width: auto;
    max-height: 70%;
    min-height: 70%;
    pointer-events: none;
    user-select: none;
}

#plus-coins {
    width: calc(var(--screen) / 1.5);
    height: calc(var(--screen) / 4.5);
    right: calc((var(--screen) / 7.4) * -1);
    border-radius: var(--screen);
    margin: initial;
    display: inline;
    transition: background-color 0.2s linear;
    animation: none;
    z-index: 5;
}

#plus-coins:hover {
    background-color: #afe8ff;
}

#plus-coins img {
    position: fixed;
    top: 0;
    width: calc(var(--screen) / 5.9);
    transform: translate(14%, 9%);
    max-height: 100%;
}

#plus-coins-available {
    position: fixed;
    color: #014456;
    animation: none;
    border-radius: 0;
    background-color: transparent;
    font-size: calc(var(--screen) / 10);
    text-decoration: none;
    right: calc(var(--screen) / 11);
    user-select: none;
    pointer-events: none;
    z-index: 10;
}

#discord-button {
    right: calc(var(--screen) / 1.75);
}

#experimental-button {
    right: calc(var(--screen) / 1.23);
}

#background-top-shadow{
    height: 15vh;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
    mix-blend-mode: multiply;
    opacity: 0.6;
}

#background-bottom {
    background: radial-gradient(#3ac7ff 60%, #1d94c3);
    clip-path: polygon(0 0, 100% 0, 100% 6.5vh, 0 6.5vh);
    top: 94%;
    bottom: 0;
}

#bottom-text-warning {
    position: relative;
    display: flex;
    justify-content: center;
    font-size: calc(var(--screen) / 11); /* calc / 8 = 1.3*/
    top: 2vh;
    z-index: 4;
    user-select: none;
}

#background-bottom-shadow {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 30vw;
    background-repeat: no-repeat;
    mix-blend-mode: difference;
    background-size: 100% auto;
    opacity: 0.9;
    transform: translateY(50%);
}

#baikun-container {
    position: absolute;
    z-index: 3;
    transition: transform 0.2s;
    -webkit-user-drag: none;
    pointer-events: none;
    animation: squishAndStretch 0.6s linear;
}

#baikun-speech-bubble-container {
    position: absolute;
    pointer-events: none;
    bottom: 30vh;
    transition: opacity 0.2s;
    user-select: none;
}

#baikun-speech-bubble-name-handle {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;

    width: 5.124vw;
    height: 4.5vh;
    background-color: #18a3d9;
    border-radius: 4vh;

    z-index: 3;

    transition: opacity 0.1s;

    transform: translateX(-180%);
    transform-origin: center center;

    font-weight: bold;
    font-size: calc(var(--screen-scale) / 5.5);
    color: white;
}

#baikun-speech-bubble {
    position: absolute;
    width: 24.597vw;
    height: 20vh;
    background-color: #5fccf0;
    box-shadow: 0px 0px 0.732vw rgba(0, 0, 0, 0.15);
    border-radius: 2.196vw;
    white-space: pre-wrap;
    transition: opacity 0.1s;
    transform: translateX(-45%);
    z-index: 2;

    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#dialog-box {
    width: 22vw;
    font-size: 14px;
}

#speech-tab-container {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 4px;
    bottom: 5%;
}

.tab {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1px;
}

.tab-border {
    border: 2px solid white;
    border-radius: 50%;
}

.tab-dot {
    width: 5px;
    height: 5px;
    background-color: white;
    border-radius: 50%;
}

#close-speech-bubble img {
    position: absolute;
    width: calc(var(--screen) / 18);
    top: 10%;
    right: 6%;
    pointer-events: all;
    transition: opacity 0.2s ease-in-out;
    opacity: 1;
}

#close-speech-bubble img:hover {
    opacity: 0.7;
}

#speech-navigation {
    position: absolute;
    width: 100%;
}

#speech-navigation img {
    position: fixed;
    transition: opacity 0.2s ease-in-out;
    pointer-events: all;
}

/*#speech-navigation img:hover {
    opacity: 0.7;
}*/

#left-navigation {
    width: 5%;
    left: 5%;
    bottom: 0%;
    transform: translateY(-70%);
}

#right-navigation {
    width: 5%;
    right: 5%;
    bottom: 0%;
    transform: scaleX(-1) translateY(-70%);
}

/*////////////////////////////////////////////////////////////////////////*/

#loading-bar {
    width: 0%;
    height: 100%;
    transition: width 0.15s ease-in-out;
    bottom: 0;
    border-radius: 10px;
}

#background-gradient {
    background: radial-gradient(circle, transparent 75%, #1d94c3);
    z-index: 4;
}

#star-pattern, #update-pattern {
    background-size: 10%;  
    translate: -50% 0%;
    z-index: 2;
    max-width: 100%;
    opacity: 0.10;
    animation: pan 50s linear infinite;
    will-change: background-position;
}

#update-pattern {
    z-index: 8;
}

@keyframes pan {
    0% {
      background-position: 0% 0%;
    }
    100% {
      background-position: 100% 100%;
    }
}

#manual-wrapper {
    position: absolute;
    bottom: 1.5vh;
    transition: bottom 0.25s ease-out;
    transform-origin: left bottom;
    width: 6.103vw;
    height: 12vh;
}

#manual-wrapper:hover {
    bottom: 3vh;
}

#manual-wrapper a {
    -webkit-user-drag: none;
}

#manual {
    position: relative;
}

.manual-scale {
    width: var(--screen-scale);
    height: calc(var(--screen-scale) * 1.2);
}

#manual-button {
    position: absolute;
    user-select: none;
    -webkit-user-drag: none;
}

#manual-tag-handle {
    position: absolute;
    z-index: -1;
    transform: translateX(99%);
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

#manual-icon {
    position: relative;
    width: calc(var(--screen) / 2.2);
    height: calc(var(--screen) / 2.2);
    transition: filter 0.25s ease-out, transform 0.25s ease-out;
    will-change: transform;
    transform: rotate(0deg);
    scale: 0.6;
    transform: translate(7%, -20%);
    pointer-events: none;
    user-select: none;
}

#manual-wrapper:hover #manual-icon {
    filter: brightness(130%);
}

.manual-text {
    position: absolute;
    z-index: 3;
    font-size: calc(var(--screen) / 7.5);
    transform: translate(18%, 170%);
    user-select: none;
    pointer-events: none;
}

#version-text {
    position: absolute;
    display: flex;
    z-index: 2;
    justify-content: right;
    
    bottom: 0;
    transform: translate(-0.5vh, -0.2vh);

    width: 100%;

    font-size: calc(var(--screen) / 12); /* calc / 8 = 1.3*/
    user-select: none;
}

/*////////////////////////////////////////////////////////////////////////*/


.shortcut-table {
    position: fixed;
    top: 50%;
    left: 0;
    transform: translate(-70%, -50%);
    border-collapse: separate;
    border-spacing: 0;
    border-width: 0;
    z-index: 4;
    filter: drop-shadow(0 calc(var(--screen) / 12) calc(var(--screen) / 6.5) rgba(0, 0, 0, 0.15));
}

.shortcut-table td {
    background-color:  #15bbff;
}

.shortcut-table a {
    font-size: calc(var(--screen) / 8); /* calc / 8 = 1.3*/
    padding-left: 2vh;
    padding-right: 5vh;
}

.table-row-border {
    border-bottom: 1vh solid #13b0f3;
    transition: background-color 0.2s;
    user-select: none;
}

tr:hover .table-row-border {
    background-color: #56d2ff;
}

.table-row-corner {
    border-top-right-radius: 0vh;
    border-bottom-right-radius: 0vh;
    transition: border-radius 0.1s ease-out;
}

tr:hover .table-row-corner {
    border-top-right-radius: 4vh;
    border-bottom-right-radius: 4vh;
}

.table-row-border img {
    width: 4.5vh;
    height: auto;
    max-width: 8vh;
    display: flex;
    padding: 2vh;
    padding-left: 2.5vh;
    -webkit-user-drag: none;
}

.table-row-border a {
    -webkit-user-drag: none;
}

.shortcut-table tr {
    background-color: #1d94c3;
    padding: 0;
    animation: slide-normal 0.1s ease-out forwards;
    will-change: transform;
}
  
.shortcut-table tr:hover {
    animation-name: slide-hover;
}

@keyframes slide-hover {
    0% {
      transform: translateX(0);
      background-color: #1d94c3;
    }
    100% {
        transform: translateX(70%);
        background-color: rgb(49, 176, 227);
    }
}
  
@keyframes slide-normal {
    from {
        transform: translateX(70%);
        background-color: rgb(49, 176, 227);
    }
    to {
        transform: translateX(0);
        background-color: #1d94c3;
    }
}

.shortcut-table tr:first-child td:last-child {
    border-top-right-radius: 4vh;
}
  
.shortcut-table tr:last-child td:last-child {
    border-bottom-right-radius: 4vh;
}

.shortcut-table tr:last-child td:first-child, .shortcut-table tr:last-child td:last-child {
    border-bottom: 0vh solid #1086bf;
}

/*////////////////////////////////////////////////////////////////////////*/

#bai-kun-inventory {
    background-color: #1d94c3;
    transition: all 0.5s;
    user-select: none;
}

.inventory-box {
    position: fixed;
    bottom: -3vh;
    right: 0;
    z-index: -1;

    border-radius: calc(var(--screen) / 12);
    width: calc(var(--screen) / 2.36);
    height: calc(var(--screen) / 0.5);
    transform-origin: top;

    justify-content: center;
    align-items: center;
}

#inventory-arrow {
    position: absolute;
    transition: transform 0.25s;
    transform: rotate(180deg);
    transform-origin: relative;
    width: calc(var(--screen) / 10);
    height: auto;
    left: 40%;
    top: 3%;
    -webkit-user-drag: none;
}

#inventory-container {
    position: absolute;
    right: 0.11vw;
    bottom: 0.8vh;

    background-color: #fff;
    border: calc(var(--screen) / 70) solid #1d94c3;
    width: 90%;
    height: calc(var(--screen) / 0.59);
    transform-origin: top;
}

.inventory-cell {
    position: relative;
    top: 0.18vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #fff;
    border: calc(var(--screen) / 80) solid;
    border-color:  #dcdcdc;
    border-radius: calc(var(--screen) / 12);
    margin: calc(var(--screen) / 100);
    transition: background-color 0.5s, border-color 0.5s;
}

.inventory-cell:hover {
    background-color: var(--hover-color);
    border-color:  #45caff;
}

.inventory-cell img {
    width: 49.5%;
    -webkit-user-drag: none;
}

.inventory-item {
    padding: calc(var(--screen) / 40);
}

.bai-kun-mood {
    background: linear-gradient(to bottom, #32c0f8, #87e2ff);
    height: calc(var(--screen) / 8);
}

.bai-kun-mood img {
    width: 35%;
    animation: rotate-move-face 8s infinite;
}

@keyframes rotate-move-face {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    35% {
        transform: translate(calc(var(--screen) / 20 * -1), calc(var(--screen) / 40 * -1)) rotate(-4deg);
    }

    60% {
        transform: translate(calc(var(--screen) / 20), calc(var(--screen) / 40)) rotate(4deg);
        /*transform: translateX(0) rotate(4deg);*/
    }
}

@keyframes pause {
    0%, 100% {
        transform: translateY(0);
    }
}

.inventory-status-bar {
    padding: calc(var(--screen) / 150);
}

.filling-rectangle {
    width: 100%;
    height: calc(var(--screen) / 30);
    bottom: 0;
    border-radius: calc(var(--screen) / 12);
}

.inventory-count {
    position: absolute;
    color: #014456;
    right: 8.5%;
    bottom: 5%;

    font-size: calc(var(--screen) / 14);
    user-select: none;
    pointer-events: none;
}

@keyframes squishAndStretch {
    0%, 100% {
        transform: scaleX(1) scaleY(1);
    }
    20% {
        transform: scaleX(calc(1 + (0.2 * var(--bounciness)))) scaleY(calc(1 - (0.2 * var(--bounciness))));
    }
    40% {
        transform: scaleY(calc(1 + (0.2 * var(--bounciness))));
    }
    60% {
        transform: scaleY(calc(1 - (0.1 * var(--bounciness))));
    }
    80% {
        transform: scaleX(calc(1 - (0.1 * var(--bounciness)))) scaleY(calc(1 + (0.1 * var(--bounciness))));
    }
}


/*////////////////////////////////////////////////////////////////////////*/

#options-panel {
    /* From https://css.glass */
    background: rgba(255, 255, 255, 0.19);
    border-radius: calc(var(--screen) / 10);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(calc(var(--screen) / 60));
    border: calc(var(--screen) / 80) solid rgba(255, 255, 255, 0.45);

    position: fixed;
    left: 50%;
    top: 51%;
    width: 78%;
    height: 78%;
    transform: translate(-50%, -50%);
    
    box-sizing: border-box;
}

.flex-container {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: flex-start;
}

.left-column, .right-column {
    flex: 3;
    overflow: auto;
    box-sizing: border-box;
    user-select: none;
}

.left-column {
    transition: flex 0.17s ease-in-out;
    flex: 0.15;
    height: 100%;
    text-align: left;
    background: rgba(58, 199, 255, 1);
    border-radius: calc(var(--screen) / 10);
    padding: calc(var(--screen) / 15);
}

.left-column:hover {
    flex: 0.8;
}

.left-column:hover .image-button {
    width: 100%;
}

.button-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: calc(var(--screen) / 15);
}

.image-button {
    width: calc(var(--screen) / 3.3);
    height: calc(var(--screen) / 3.3);
    color: #525252;
    background-color: white;
    transition: width 0.17s ease-in-out, background-color 0.3s ease-in-out, color 0.3s ease-in-out, border 0.3s ease-in-out;
    display: flex;
    align-items: center;
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
    padding: calc(var(--screen) / 20);
    border: calc(var(--screen) / 160) solid rgba(163, 163, 163, 0.5);
    border-radius: calc(var(--screen) / 5);
    cursor: pointer;
    font-family: "Cabin Condensed" !important;
}

.image-button:hover {
    background-color: rgb(135, 221, 255);
    border: calc(var(--screen) / 160) solid #1d94c3;
    color: white;
}

.image-button img {
    margin: calc(var(--screen) / 15);
    margin-left: calc(var(--screen) / 40);
    height: calc(var(--screen) / 6.5);
    transition: transform 0.3s ease-in-out, background-color 0.3s ease-in-out, filter 0.3s ease-in-out;
}

.image-button:hover img {
    animation: squishStretchAndRotate 0.3s linear;
    transform: rotate(-20deg);
    filter: grayscale(100%) brightness(1000%) contrast(100%);
    -webkit-filter: grayscale(100%) brightness(1000%) contrast(100%);
}

.selected-menu {
    background-color: #3ac7ff;
    border: calc(var(--screen) / 160) solid #1d94c3;
    color: white;
}

.selected-menu img {
    filter: grayscale(100%) brightness(1000%) contrast(100%);
}

.right-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    height: 100%;
    width: 100%;
    overflow: auto;
    box-sizing: border-box;
}

.right-column td:first-child {
    color: #525252;
    left: 0;
    text-align: left;
    font-size: calc(var(--screen) / 9); /* calc / 8 = 1.3*/
    letter-spacing: 0.05px;
}

.table-center td:first-child {
    text-align: center;
}



/*////////////////////////////////////////////////////////////////////////*/

.home {
    display: flex;
    justify-content: flex-start;
    align-items: center; 
    text-align: center;
    height: 100%;
}

.home h1, .home h2, .home h3 {
    margin: 2px;
    color: #13b0f3;
}

.home h1 {
    font-size: calc(var(--screen) / 1.5); /* calc / 8 = 1.3*/
    letter-spacing: -2px;
}

.home h3 {
    font-size: calc(var(--screen) / 12); /* calc / 8 = 1.3*/
    margin: 0px;
}

.home .enabler {
    margin-top: 30px;
}

.home .separator {
    margin-bottom: 20px;
}

.home a {
    color: #13b0f3;
}

.home-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 92%;
    text-align: center;
    padding: 20px;
}

.value {
    margin-top: 15px;
}

#page-indicator {
    margin: 15px;
}

.results-found {
    margin: 5px;
    text-align: left;
}

/* Customize the vertical and horizontal scrollbar width/height */
::-webkit-scrollbar {
    width: calc(var(--screen) / 12);   /* Vertical scrollbar width */
    height: calc(var(--screen) / 12);  /* Horizontal scrollbar height */
    overflow: auto;
}

/* Set the background color of the scrollbar track */
::-webkit-scrollbar-track {
    background: transparent;
}

/* Customize the scrollbar thumb */
::-webkit-scrollbar-thumb {
    background: #13b0f3;
    border-radius: 8px;
}

/* Change the appearance of the scrollbar thumb on hover */
::-webkit-scrollbar-thumb:hover {
    background: #56d2ff;
}

/* Customize the scrollbar buttons (arrows) */
::-webkit-scrollbar-button {
    display: none;
}


/*////////////////////////////////////////////////////////////////////////*/

.tooltiptext {
    display: none;
}

.enabler-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-right: 10px;
}

.enabler-container::before {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: radial-gradient(circle, silver 0%, transparent 70%);
}

.switch {
    display: inline-block;
    width: var(--switch-width);
    height: var(--switch-height);
    position: relative;
    
}

.switch input {
    display: none;
}

.slider {
    background-color: var(--slider-color);
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    cursor: pointer;
    transition: background-color 0.4s;
}

.slider:before {
    content: "";
    position: absolute;
    left: var(--slider-knob-offset);
    bottom: var(--slider-knob-offset);
    width: var(--slider-knob-size);
    height: var(--slider-knob-size);
    background-color: #fff;
    transition: transform 0.4s;
}

input:checked + .slider {
    background-color: #13b0f3;
}

input:checked+.slider-danger {
    background-color: #ff515f;
}

input:focus+.slider-danger {
    box-shadow: 0 0 1px #ff515f;
}

input:checked + .slider:before {
    transform: translateX(calc(var(--switch-width) - var(--switch-height)));
}

.slider.round {
    border-radius: var(--switch-height);
}

.slider.round:before {
    border-radius: 50%;
}

/*////////////////////////////////////////////////////////////////////////*/

.danger-input {
    background: linear-gradient(21deg, #d9181b, #f05e66) !important;
}

.input, select {
    position: relative;
    background-color: #13b0f3;
    padding: 2px;
    display: inline-block;
    border-radius: 9999em;
}

select, .battledome-weapon {
    background: white;
    width: 250px;
}

.input > * {
    position: relative;
    display: inherit;
    border-radius: inherit;
    margin: 0;
    border: none;
    outline: none;
    z-index: 1;
}

.input input, select, select option {
    font-family: "Cabin Condensed";
    line-height: inherit;
    color: #525252;
    padding-left: 5px;
    text-align: center;
    border: none;
    outline: none;
    font-size: calc(var(--screen) / 9); /* calc / 8 = 1.3*/
    letter-spacing: -0.5px;
    font-weight: bold;
    transition: all 0.5s;
}

.danger-input input:focus, 
.danger-input select:focus { 
    box-shadow: inset 0 0 0 3px #fff,
                0 0 0 4px #fff,
                3px -3px 30px #d9181b, 
                -3px 3px 30px #f05e66 !important;
}

/* Ensure .input does not get overridden */
.input:not(.danger-input) input:focus, 
.input:not(.danger-input) select:focus {
    box-shadow: inset 0 0 0 3px #fff,
                0 0 0 4px #fff,
                3px -3px 30px #18a3d9, 
                -3px 3px 30px #5fccf0 !important;
}

.input input:disabled {
    color: #9f9f9f;
    background-color: #f1f1f1;
    border-radius: inherit;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

/* Search Bar */
.search-bar-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.search-bar {
    display: flex;
    align-items: center;
    width: 80%;
    max-width: 500px;
}

.search-bar input {
    flex: 1;
    padding: 5px;
    text-align: left;
    text-indent: 10px;
}

.search-bar img {
    width: 20px;
    height: auto;
    border-radius: 0 !important;
    display: block;
    padding: 0 10px 0 10px;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
}

.card-grid {
  transform: translateX(-5px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.item-card .card-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin-bottom: 10px;
}

.item-card {
  background: #fff;
  border: 1px solid #ccc;
  padding: 8px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.1);
  position: relative;
}

.item-card h3 {
    margin-bottom: 10px;
}

.item-card p {
  position: absolute;
  bottom: 8px;
  left: 5%; 
  right: 5%; 
  margin: 0;  
  padding: 2%;
  border-radius: 16px;
  background-color: #5858583a;
  font-size: 14px;
}

.item-card .card-urls {
    padding-bottom: 30px;
}

.item-card .card-urls img {
    max-width: 17px;
}

::placeholder {
    color: #cbd0d5;
}

.notation { 
    color: white;
    font-size: calc(var(--screen) / 9); /* calc / 8 = 1.3*/
    padding-left: 10px;
    padding-right: 10px;
    font-weight: bold;
}

textarea {
    color: #525252;
    font-family: "Cabin Condensed";
    font-size: calc(var(--screen) / 9); /* calc / 8 = 1.3*/
    font-weight: bold;
    border-radius: 10px;
    border-color: #18a3d9;
    border-width: 2px;
    color: #18a3d9;
    height: 250px;
}

/*////////////////////////////////////////////////////////////////////////*/

.table {
    border-collapse: collapse;
    width: 100%;
}

.table tr {
    font-size: calc(var(--screen) / 9); /* calc / 8 = 1.3*/
    letter-spacing: -0.3px;
    font-weight: bold;

    background-color: rgba(82, 82, 82, 0.05);
    border-radius: 20px;
    backdrop-filter: blur(calc(var(--screen) / 60));

    padding: 5px;
    box-sizing: border-box;

    display: flex;
    align-items: center;
    margin-bottom: 5px;
    transition: background-color 0.3s ease-in-out;
}

.table td {
    flex: 2;
    margin-left: 10px;
}

/* Apply the checked-row class with higher specificity */
table:not(.ignore-alternate-rows) tr.checked-row {
    background-color: #c0ffb3;
}

table:not(.ignore-alternate-rows) tr.battledome-row {
    background-color: #ffb3b3;
}

table:not(.ignore-alternate-rows) tr.quest-row {
    background-color: #ffd9b3;
}

table:not(.ignore-alternate-rows) tr.deposit-row {
    background-color: #b3d0ff;
}

table:not(.ignore-alternate-rows) tr.gallery-row {
    background-color: #fcffb3;
}


.table-header th {
    flex: 2;
    padding: 10px;
    margin-left: 10px;
    text-align: center;
    background-color: #3ac7ff;
    color: white;
}

.table-header th::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;

    background-color: inherit;
    border-radius: 20px;
}

.table-header {
    text-align: center;
}

.hidden {
    display: none !important;
}

.pie-chart {
    max-width: 100%;
}

.chart-container {
    display: flex;
    justify-content: center;
    align-items: center;  
    height: 100%;
}

.chart-container canvas {
    margin: 0;
    transform: none;
}

.footnote {
    font-size: calc(var(--screen) / 10); /* calc / 8 = 1.3*/
}

.justified {
    text-align: justify !important;
    margin: 20px 0;
}

.justified li, .justified p {
    margin-bottom: 20px;
    font-size: calc(var(--screen) / 9); /* calc / 8 = 1.3*/
}


/*////////////////////////////////////////////////////////////////////////*/


.button input {
    display: none;
}

.button, .autobuyerButton {
    font-family: "Cabin Condensed";
    font-size: calc(var(--screen) / 9); /* calc / 8 = 1.3*/
    font-weight: bold;

    color: #525252;
    background-color: white;

    transition: width 0.17s ease-in-out, background-color 0.3s ease-in-out, color 0.3s ease-in-out, border 0.3s ease-in-out;
    border: 2px solid rgba(163, 163, 163, 0.5);
    border-radius: 10px;

    width: 14.5vw;
    height: 8vh;
    margin: 15px;
}

.longButton {
    width: 400px;
}

.small-button {
    width: 8vw;
}

.button:hover, .autobuyerButton:hover {
    background-color: #3ac7ff;
    border: 2px solid #1d94c3;
    color: white;
}

.cancel-button {
    background-color: #ff515f;
    color: white;
}

.cancel-button:hover {
    background-color: #ff4141;
    border: 2px solid #f32121;
    color: white;
}

.center-buttons{
    display: flex;
    align-items: center;
    justify-content: center;
}

/*////////////////////////////////////////////////////////////////////////*/

.mail-icon {
    max-width: 35px;
}

#message-container {
    display: none;
    border-collapse: collapse;
    text-align: left;
}

#message-container a {
    font-size: calc(var(--screen) / 8); /* calc / 8 = 1.3*/
    font-weight: bold;
}

#message-container tr:nth-child(-n+3) {
    background: linear-gradient(to right, #3ac7ff 12.5%, rgba(255, 255, 255, 0.1) 0%);
}

#message-container tr:nth-child(4) {
    background: linear-gradient(to right, #3ac7ff 1.5%, rgba(255, 255, 255, 0) 0%);
}

#message-container td:first-child {
    flex: 0.3;
}

#message-container .message-information {
    flex: auto;
}

#message-title {
    text-align: center;
}

.message-section {
    color: #13b0f3 !important;
}

.message-section a {
    color: white;
}

#avatar-section {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    font-size: calc(var(--screen) / 7); /* calc / 8 = 1.3*/
}

.neofriend-message {
    font-size: calc(var(--screen) / 10); /* calc / 8 = 1.3*/
}

.avatar-column {
    flex: 1;
}

.text-column {
    flex: 8;
    color: #13b0f3;
}

.text-column #mail-author-name {
    color: #1aa4d9;
}

.message-justified {
    text-align: justify !important;
    margin: 20px 0;
}

#message {
    font-size: calc(var(--screen) / 8); /* calc / 8 = 1.3*/
    line-height: 24px;
    text-shadow:0 0 1px transparent;
    letter-spacing: 0.012rem;
    word-spacing: 0.11rem;
}

#message img {
    max-width: 40vw;
    height: auto;
}

/* .message For BAI-kun conversations*/ 

/*////////////////////////////////////////////////////////////////////////*/

.controller-container{
    display: flex;
}

.controller-name {
    display: flex;
    flex-grow: 1;
    margin-left: 8px;
    align-items: center;
}

.element-button {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 15px;
    left: 0px;
    margin: 0px;
    margin-top: 5px;
    margin-bottom: 5px;
    font-size: calc(var(--screen-scale) / 4.5);
}

/*////////////////////////////////////////////////////////////////////////*/
/* Section tab changes; panels are display: inline, so their children are animated; */

@keyframes panelForward {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
}

@keyframes panelBack {
    from { opacity: 0; transform: translateY(-18px); }
    to { opacity: 1; transform: none; }
}

.right-column > .panel-forward > * {
    animation: panelForward 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.right-column > .panel-back > * {
    animation: panelBack 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.image-button {
    transition: width 0.17s ease-in-out, background-color 0.3s ease-in-out, color 0.3s ease-in-out, border 0.3s ease-in-out, transform 0.15s ease;
}

.image-button:active {
    transform: scale(0.94);
}

@media (prefers-reduced-motion: reduce) {
    .right-column > .panel-forward > *,
    .right-column > .panel-back > * {
        animation: none;
    }
}

/*////////////////////////////////////////////////////////////////////////*/
/* Membership (Extension Settings); */

.membership-layout {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: calc(var(--screen) / 3);
    width: 100%;
    padding: calc(var(--screen) / 6);
}

.member-card {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;

    width: calc(var(--screen) * 2.3);
    aspect-ratio: 1.586;
    padding: calc(var(--screen) / 8);
    border-radius: calc(var(--screen) / 9);

    color: white;
    text-align: left;
    background: linear-gradient(135deg, #3ac7ff, #1d94c3);
    box-shadow: 0 calc(var(--screen) / 20) calc(var(--screen) / 6) rgba(29, 148, 195, 0.3);
}

.member-card-logo {
    width: 45%;
}

.member-card-tier {
    font-size: calc(var(--screen) / 3.2);
    font-weight: bold;
    line-height: 1;
}

.member-card-bottom {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: calc(var(--screen) / 10);
    opacity: 0.95;
}

.membership-side {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.membership-side h1 {
    font-size: calc(var(--screen) / 2.4) !important;
    line-height: 1;
}

.membership-side h3 {
    margin: 6px 0 calc(var(--screen) / 7) !important;
    font-size: calc(var(--screen) / 8) !important;
}

.membership-key {
    display: flex;
    align-items: center;
    gap: calc(var(--screen) / 15);
}

.membership-key .input {
    flex: 1;
}

.membership-key .input,
.membership-key .input input {
    box-sizing: border-box;
    width: 100%;
}

.membership-key .input input {
    height: calc(var(--screen) / 3.6);
}

.membership-message {
    min-height: 1.2em;
    margin: 8px 0;
    color: #13b0f3;
    font-size: calc(var(--screen) / 10.5);
}

.membership-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--screen) / 15);
}

.membership-key .button,
.membership-buttons .button {
    width: auto;
    height: auto;
    margin: 0;
    padding: calc(var(--screen) / 18) calc(var(--screen) / 9);
    white-space: nowrap;
    cursor: pointer;
}

.membership-buttons .button[hidden] {
    display: none;
}

.button:disabled {
    opacity: 0.5;
    cursor: default;
}

/*////////////////////////////////////////////////////////////////////////*/
/* Phones; */

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    :root {
        --switch-width: 64px;
        --switch-height: 28px;
    }

    /* BAI-kun can wander past the screen edge; don't let him widen the page; */
    #background {
        overflow: hidden;
    }

    /* Toolbar: the logo, then each section icon centered on a tooth tip (placed by layout.js); */
    #autobuyer-logo {
        width: 25vw;
        translate: none;
        transform: translate(3vw, calc(90vh + 1.6vh));
    }

    /* No room for the round buttons and coin counter on phones; */
    .round-toolbar-button {
        display: none;
    }

    .navigation-container {
        top: 1.6vh;
        width: auto;
        height: auto;
        transform: translateX(-50%);
    }

    .navigation-container a {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .navigation-container a .navigation-option {
        width: 7.4vw;
    }

    .dropdown-arrow {
        position: static;
        width: 2.6vw;
        height: auto;
        margin-top: 2px;
        transform: none;
    }

    .neomail-notification {
        top: 0;
        right: -4px;
        transform: none;
    }

    /* Dropdowns open centered under the toolbar; */
    .hover-menu {
        left: 50% !important;
        top: 11vh;
        min-width: 60vw;
        z-index: 8;
    }

    .hover-menu ul:first-child {
        margin-top: 0;
    }

    .hover-menu a, .hover-submenu a {
        padding: 10px 14px;
        font-size: 17px;
    }

    .toolbar-category .dropdown-icon {
        max-width: 26px;
        margin-right: 10px;
    }

    .hover-submenu {
        position: static;
        transform: none;
        box-shadow: none;
        padding: 0 0 0 16px;
    }

    .dropleft-arrow {
        transform: rotate(0deg);
    }

    .hover-menu li:hover .dropleft-arrow {
        transform: rotate(180deg);
    }

    /* The quicklinks are for keyboard shortcuts; the toolbar covers navigation on phones; */
    .shortcut-table {
        display: none;
    }

    /* Footer; */
    #background-bottom {
        top: auto;
        bottom: 0;
        height: 9vh;
        clip-path: none;
    }

    /* Equal room on both sides keeps the text centered next to the manual tab; */
    #bottom-text-warning {
        top: 1.2vh;
        padding: 0 calc(var(--screen-scale) + 8px);
        font-size: 10.5px;
        text-align: center;
    }

    #version-text {
        font-size: 10px;
    }

    /* Centered inside the footer bar; */
    #manual-wrapper {
        height: calc(var(--screen-scale) * 1.2);
        bottom: calc((9vh - var(--screen-scale) * 1.2) / 2);
        z-index: 6;
    }

    #manual-wrapper:hover {
        bottom: calc((9vh - var(--screen-scale) * 1.2) / 2 + 4px);
    }

    /* Options panel: the section menu becomes a row of tabs above the settings; */
    #options-panel {
        top: calc(11vh + 4px);
        bottom: calc(9vh + 6px);
        left: 8px;
        right: 8px;
        width: auto;
        height: auto;
        transform: none;
        border-radius: 18px;
    }

    .flex-container {
        flex-direction: column;
    }

    .left-column,
    .left-column:hover {
        flex: none;
        width: 100%;
        height: auto;
        padding: 8px;
        border-radius: 14px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    /* Tabs shrink to fit (7 at most on a page), so the row stays centered; */
    .button-container {
        flex-direction: row;
        justify-content: center;
        gap: 6px;
    }

    .image-button,
    .left-column:hover .image-button {
        flex: 0 1 46px;
        min-width: 36px;
        width: 46px;
        height: 46px;
        padding: 0;
        justify-content: center;
        border-radius: 14px;
        font-size: 0; /* Icons only; the labels don't fit; */
    }

    .image-button img {
        margin: 0;
        height: 24px;
    }

    .right-column {
        flex: 1;
        min-height: 0;
        height: auto;
        padding: 8px 4px;
        justify-content: flex-start;
    }

    .home {
        height: auto;
    }

    .home-center {
        height: auto;
        padding: 10px 4px;
    }

    .home h1 {
        font-size: 44px;
        letter-spacing: -1px;
    }

    .home h2 {
        font-size: 18px;
    }

    .home h3 {
        font-size: 14px;
    }

    .home .enabler {
        margin-top: 16px;
    }

    /* Rows keep label and small controls side by side; wide controls wrap below; */
    .table,
    .table tbody {
        gap: 10px;
    }

    .table tr {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px !important;
        border-radius: 14px;
        font-size: 16px;
    }

    .table td {
        flex: 1 1 auto;
        margin-left: 0;
    }

    .table td:first-child {
        flex: 1 1 55%;
    }

    .right-column td:first-child {
        font-size: 16px;
    }

    .button, .autobuyerButton {
        width: auto;
        min-width: 42%;
        height: auto;
        min-height: 46px;
        padding: 10px 16px;
        margin: 6px;
        font-size: 16px;
    }

    .longButton, .small-button {
        width: auto;
    }

    .center-buttons {
        flex-wrap: wrap;
    }

    .input input, select, select option {
        font-size: 16px; /* 16px stops mobile browsers from zooming into the field; */
        min-height: 40px;
    }

    select, .battledome-weapon {
        max-width: 100%;
    }

    .notation {
        font-size: 15px;
    }

    /* Tabs are a row here, so sections slide in sideways; */
    @keyframes panelForwardRow {
        from { opacity: 0; transform: translateX(24px); }
        to { opacity: 1; transform: none; }
    }

    @keyframes panelBackRow {
        from { opacity: 0; transform: translateX(-24px); }
        to { opacity: 1; transform: none; }
    }

    .right-column > .panel-forward > * {
        animation-name: panelForwardRow;
    }

    .right-column > .panel-back > * {
        animation-name: panelBackRow;
    }

    /* Membership; */
    .membership-layout {
        flex-direction: column;
        gap: 18px;
        padding: 10px 4px;
    }

    .member-card {
        width: min(100%, 320px);
        padding: 16px 18px;
        border-radius: 16px;
    }

    .member-card-tier {
        font-size: 30px;
    }

    .member-card-bottom {
        font-size: 13px;
    }

    .membership-side {
        width: 100%;
        text-align: center;
    }

    .membership-side h1 {
        font-size: 40px !important;
    }

    .membership-side h3 {
        font-size: 16px !important;
        margin-bottom: 16px !important;
    }

    .membership-key,
    .membership-buttons {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .membership-message {
        font-size: 15px;
    }

    .membership-key .button,
    .membership-buttons .button {
        width: 100%;
        min-width: 0;
        padding: 12px 16px;
        font-size: 16px;
    }

    /* Update screen: just the title, the key sentence and the buttons; */
    body:has(#update-screen) {
        margin: 0;
        overflow-y: auto;
    }

    #update-screen,
    #update-pattern {
        position: fixed;
        inset: 0;
    }

    #update-screen + div {
        position: relative;
        z-index: 9;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 100vh;
        padding: 24px 22px 84px;
    }

    .update-icon {
        position: relative;
        display: block;
        width: 56px;
        height: auto;
        margin: 0 auto 12px;
        transform: none;
    }

    .update-status {
        position: relative;
        text-align: center;
    }

    #update-title {
        position: relative;
        margin: 0;
        font-size: 30px;
        line-height: 1.1;
        text-align: center;
    }

    #update-message {
        position: relative;
        padding: 0;
        font-size: 16px;
    }

    #update-message p {
        margin: 12px 0 0;
        text-align: center;
    }

    #update-message p:not(:first-child) {
        display: none;
    }

    .update-options {
        position: relative;
        box-sizing: border-box;
        flex-direction: column;
        gap: 10px;
        width: 100%;
        margin-top: 24px;
        padding: 0;
    }

    .update-options a {
        display: block;
        width: 100%;
    }

    .update-button {
        box-sizing: border-box;
        width: 100%;
        min-height: 48px;
        margin: 0;
        font-size: 16px;
    }

    .update-image-button {
        position: fixed;
        bottom: 16px;
        left: 16px;
    }

    /* BAI-kun's speech bubble; */
    #baikun-speech-bubble {
        width: 80vw;
        height: auto;
        min-height: 19vh;
        padding: 18px 14px 26px;
        border-radius: 18px;
    }

    #dialog-box {
        width: 68vw;
        font-size: 15px;
    }

    #baikun-speech-bubble-name-handle {
        width: 20vw;
        font-size: 14px;
    }

    #close-speech-bubble img {
        width: 16px;
    }

    #left-navigation,
    #right-navigation {
        width: 7%;
    }
}

/*////////////////////////////////////////////////////////////////////////*/
/* Night theme (set by common/theme.js); */

[data-theme="dark"] {
    --slider-color: #3a4b5a;
    color-scheme: dark;
}

[data-theme="dark"] body {
    color: #d6e2ea;
    background-color: #0d1a26;
}

/* Tints the checkered background navy; */
[data-theme="dark"] #background {
    background-color: #0d1a26;
    background-blend-mode: multiply;
}

[data-theme="dark"] #background-top,
[data-theme="dark"] #background-bottom {
    background: radial-gradient(#1e7fae 60%, #0f4a6b);
}

[data-theme="dark"] #background-gradient {
    background: radial-gradient(circle, transparent 75%, #0f4a6b);
}

[data-theme="dark"] .hover-menu,
[data-theme="dark"] .hover-submenu {
    background-color: #1a6f96;
}

[data-theme="dark"] .hover-menu a:hover,
[data-theme="dark"] .hover-submenu a:hover {
    background-color: #2287b5;
}

/* !important: the hover animations set these colors too; */
[data-theme="dark"] .round-toolbar-button .toolbar-link {
    background-color: #1b2d3e !important;
}

[data-theme="dark"] .round-toolbar-button .toolbar-link:hover {
    background-color: #24445c !important;
}

[data-theme="dark"] #plus-coins-available {
    color: #cfe9f7;
}











[data-theme="dark"] .item-card {
    background: #13212e;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] #baikun-speech-bubble {
    background-color: #2a8fb8;
}

[data-theme="dark"] #baikun-speech-bubble-name-handle {
    background-color: #1a6f96;
}

[data-theme="dark"] .member-card {
    background: linear-gradient(135deg, #2a9fd6, #145f86);
    box-shadow: 0 calc(var(--screen) / 20) calc(var(--screen) / 6) rgba(0, 0, 0, 0.35);
}

/* The floor shadow's blend turns brown on navy; */
[data-theme="dark"] #background-bottom-shadow {
    display: none;
}

/*////////////////////////////////////////////////////////////////////////*/
/* Classic glass: the original look, frosted; night versions below; */

:root {
    --ui-ink: #525252;
    --ui-muted: #7f8c95;
    --ui-accent: #13b0f3;
    --ui-divider: rgba(82, 82, 82, 0.1);

    /* The original frosted panel; */
    --ui-panel-bg: rgba(255, 255, 255, 0.19);
    --ui-panel-border: calc(var(--screen) / 80) solid rgba(255, 255, 255, 0.45);
    --ui-panel-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    --ui-panel-blur: blur(calc(var(--screen) / 60));
    --ui-sidebar-bg: #3ac7ff;

    /* The original rows; */
    --ui-card-bg: rgba(82, 82, 82, 0.05);
    --ui-card-border: 1px solid transparent;
    --ui-card-edge: none;
    --ui-card-blur: none;

    /* The original crisp controls; */
    --ui-raised-bg: white;
    --ui-raised-ink: #525252;
    --ui-raised-border: calc(var(--screen) / 160) solid rgba(163, 163, 163, 0.5);
    --ui-raised-edge: none;
    --ui-hover-bg: #3ac7ff;
    --ui-hover-ink: white;
    --ui-hover-border: calc(var(--screen) / 160) solid #1d94c3;
    --ui-hover-edge: none;
    --ui-selected-bg: #3ac7ff;
    --ui-selected-border: calc(var(--screen) / 160) solid #1d94c3;

    --ui-primary-bg: #3ac7ff;
    --ui-primary-ink: white;
    --ui-primary-border: calc(var(--screen) / 160) solid #1d94c3;
    --ui-danger-bg: #ff515f;
    --ui-danger-border: calc(var(--screen) / 160) solid #d9303e;

    --ui-field-bg: white;
    --ui-field-ink: #525252;
    --ui-field-rim: #13b0f3;
    --ui-notation-ink: white;

    --ui-track-off: #ccc;
    --ui-track-on: #13b0f3;
    --ui-track-danger: #ff515f;
    --ui-knob: white;
    --ui-knob-edge: none;

    /* Glass for the floating pieces (dropdowns, dock, scroll hint); */
    --ui-float-bg: rgba(255, 255, 255, 0.72);
    --ui-float-border: 1px solid rgba(255, 255, 255, 0.85);
    --ui-float-blur: blur(12px) saturate(150%);

    /* The mouse light on the rows (common/layout.js); */
    --light-fill: rgba(255, 255, 255, 0.55);
    --light-rim: rgba(255, 255, 255, 0.9);

    --ui-radius: calc(var(--screen) / 7);
    --ui-button-radius: 12px;
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    --px: 0;
    --py: 0;
}

/* Night: each layer a step lighter than the one under it; */
[data-theme="dark"] {
    --ui-ink: #e3edf3;
    --ui-muted: #93a8b7;
    --ui-accent: #4cc6ff;
    --ui-divider: rgba(255, 255, 255, 0.08);

    --ui-panel-bg: rgba(14, 27, 40, 0.72);
    --ui-panel-border: calc(var(--screen) / 80) solid rgba(255, 255, 255, 0.07);
    --ui-panel-shadow: 0 4px 30px rgba(0, 0, 0, 0.35);
    --ui-sidebar-bg: #1a6f96;

    --ui-card-bg: #1b3044;
    --ui-card-border: 1px solid rgba(255, 255, 255, 0.05);

    --ui-raised-bg: #253d53;
    --ui-raised-ink: #e3edf3;
    --ui-raised-border: calc(var(--screen) / 160) solid rgba(255, 255, 255, 0.12);
    --ui-hover-bg: #2287b5;
    --ui-hover-border: calc(var(--screen) / 160) solid #3ac7ff;
    --ui-selected-bg: #2287b5;
    --ui-selected-border: calc(var(--screen) / 160) solid #3ac7ff;

    --ui-primary-bg: #2287b5;
    --ui-primary-border: calc(var(--screen) / 160) solid #3ac7ff;
    --ui-danger-bg: #d9404c;
    --ui-danger-border: calc(var(--screen) / 160) solid #ff6b77;

    --ui-field-bg: #0f1d2a;
    --ui-field-ink: #e3edf3;
    --ui-field-rim: #1d94c3;

    --ui-track-off: #34495b;
    --ui-track-on: #1fa6e0;
    --ui-track-danger: #e0505c;
    --ui-knob: #f2f7fa;

    --ui-float-bg: rgba(27, 48, 68, 0.78);
    --ui-float-border: 1px solid rgba(255, 255, 255, 0.1);

    --light-fill: rgba(140, 210, 255, 0.1);
    --light-rim: rgba(160, 222, 255, 0.45);
}

/*////////////////////////////////////////////////////////////////////////*/
/* Components (every options page); */

#options-panel {
    background: var(--ui-panel-bg);
    border: var(--ui-panel-border);
    box-shadow: var(--ui-panel-shadow);
    backdrop-filter: var(--ui-panel-blur);
    -webkit-backdrop-filter: var(--ui-panel-blur);
    translate: calc(var(--px) * -4px) calc(var(--py) * -3px);
    transition: translate 0.3s ease-out;
}

/* Parallax: the background drifts a little with the mouse (common/layout.js); */
#background {
    background-size: auto calc(100% + 24px);
    background-position: calc(50% + var(--px) * 12px) calc(50% + var(--py) * 8px);
}

#star-pattern {
    translate: calc(-50% + var(--px) * 8px) calc(var(--py) * 6px);
}

.left-column {
    background: var(--ui-sidebar-bg);
}

.image-button {
    color: var(--ui-raised-ink);
    background-color: var(--ui-raised-bg);
    border: var(--ui-raised-border);
    box-shadow: var(--ui-raised-edge);
}

[data-theme="dark"] .image-button:not(.selected-menu) img {
    filter: brightness(0) invert(0.88);
}

.image-button:hover {
    color: var(--ui-hover-ink);
    background-color: var(--ui-hover-bg);
    border: var(--ui-hover-border);
    box-shadow: var(--ui-hover-edge);
}

.selected-menu,
.selected-menu:hover {
    color: white;
    background-color: var(--ui-selected-bg);
    border: var(--ui-selected-border);
    box-shadow: none;
}

.table tr {
    color: var(--ui-ink);
    background-color: var(--ui-card-bg);
    border: var(--ui-card-border);
    box-shadow: var(--ui-card-edge);
}

.right-column td:first-child,
.membership-side {
    color: var(--ui-ink);
}

.button,
.autobuyerButton {
    color: var(--ui-raised-ink);
    background-color: var(--ui-raised-bg);
    border: var(--ui-raised-border);
    border-radius: var(--ui-button-radius);
    box-shadow: var(--ui-raised-edge);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.12s ease;
}

.button:hover,
.autobuyerButton:hover {
    color: var(--ui-hover-ink);
    background-color: var(--ui-hover-bg);
    border: var(--ui-hover-border);
    box-shadow: var(--ui-hover-edge);
}

.primary-button,
.primary-button:hover {
    color: var(--ui-primary-ink);
    background-color: var(--ui-primary-bg);
    border: var(--ui-primary-border);
}

.danger-button,
.danger-button:hover {
    color: white;
    background-color: var(--ui-danger-bg);
    border: var(--ui-danger-border);
}

.button:active,
.autobuyerButton:active {
    transform: translateY(1px);
}

.button:focus-visible,
.autobuyerButton:focus-visible,
.image-button:focus-visible {
    outline: 2px solid var(--ui-accent);
    outline-offset: 2px;
}

.input,
select {
    background-color: var(--ui-field-rim);
}

.danger-input {
    background: var(--ui-danger-bg) !important;
}

.notation {
    color: var(--ui-notation-ink);
}

.input input,
.input select,
textarea {
    color: var(--ui-field-ink);
    background-color: var(--ui-field-bg);
}

select option {
    color: #33424d;
    background: white;
}

.input input:disabled {
    color: var(--ui-muted);
    background-color: var(--ui-card-bg);
}

textarea {
    border: var(--ui-raised-border);
    border-radius: var(--ui-button-radius);
    padding: 10px 12px;
    font-family: "Cabin Condensed";
    resize: vertical;
    outline: none;
}

textarea:focus {
    border-color: var(--ui-accent);
}

.slider {
    background-color: var(--ui-track-off);
}

.slider:before {
    background: var(--ui-knob);
    box-shadow: var(--ui-knob-edge);
    transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}

input:checked + .slider {
    background-color: var(--ui-track-on);
}

input:checked + .slider-danger {
    background-color: var(--ui-track-danger);
}

/*////////////////////////////////////////////////////////////////////////*/
/* Refreshed page layout (pilot: AutoBuyer+); */

.refreshed-page .right-column {
    justify-content: flex-start;
    padding: calc(var(--screen) / 9) calc(var(--screen) / 7);
}

.refreshed-page .home {
    color: var(--ui-ink);
    text-align: left;
}

.refreshed-page .input {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.refreshed-page .input input {
    width: calc(var(--screen) / 1.4);
}

.page-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--screen) / 6);
    margin-bottom: calc(var(--screen) / 9);
}

.page-hero h1 {
    margin: 0 !important;
    color: var(--ui-accent) !important;
    font-size: calc(var(--screen) / 2) !important;
    line-height: 1;
    letter-spacing: -1px;
}

.page-hero p,
.panel-heading p,
.settings-group header p {
    margin: 4px 0 0;
    color: var(--ui-muted);
    font-size: calc(var(--screen) / 10);
}

.status-row {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--screen) / 18);
}

.status-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(var(--screen) * 1.4);
    padding: calc(var(--screen) / 22) calc(var(--screen) / 10);
    border-radius: var(--ui-button-radius);
    background-color: var(--ui-raised-bg);
    border: var(--ui-raised-border);
    box-shadow: var(--ui-raised-edge);
}

.status-chip span {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.status-chip small {
    color: var(--ui-muted);
    font-size: calc(var(--screen) / 14);
}

.status-chip strong {
    color: var(--ui-ink);
    font-size: calc(var(--screen) / 10);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-dot {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #a9b8c3;
}

.status-dot.status-on {
    background: #3ddc84;
}

.panel-heading {
    margin-bottom: calc(var(--screen) / 12);
}

.panel-heading h2 {
    margin: 0 !important;
    color: var(--ui-accent) !important;
    font-size: calc(var(--screen) / 4.5) !important;
}

.panel-heading.with-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--screen) / 10);
}

.panel-heading .center-buttons .button {
    width: auto;
    height: auto;
    margin: 0 0 0 8px;
    padding: calc(var(--screen) / 20) calc(var(--screen) / 9);
}

/* A group is one card; its rows become lines inside it; */
.settings-group {
    margin-bottom: calc(var(--screen) / 10);
    padding: calc(var(--screen) / 14) calc(var(--screen) / 9);
    border-radius: var(--ui-radius);
    background-color: var(--ui-card-bg);
    border: var(--ui-card-border);
    box-shadow: var(--ui-card-edge);
}

.settings-group header {
    padding: calc(var(--screen) / 30) 0 calc(var(--screen) / 22);
    border-bottom: 1px solid var(--ui-divider);
}

.settings-group header h4 {
    margin: 0;
    color: var(--ui-ink);
    font-size: calc(var(--screen) / 7.5);
}

.settings-group .table,
.settings-group .table tbody {
    gap: 0;
}

.settings-group .table tr,
.shop-list .data-point .table tr {
    padding: calc(var(--screen) / 18) 0 !important;
    background-color: transparent;
    border: none;
    border-bottom: 1px solid var(--ui-divider);
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
}

.settings-group .table tr:last-child,
.shop-list .data-point .table tr:last-child {
    border-bottom: none;
}

.settings-group .table td:last-child,
.shop-list .data-point .table td:last-child {
    display: flex;
    justify-content: flex-end;
    gap: calc(var(--screen) / 22);
    flex: 0 1 auto;
}

.setting-label {
    display: block;
    color: var(--ui-ink);
}

.setting-hint {
    display: block;
    margin-top: 2px;
    color: var(--ui-muted);
    font-size: calc(var(--screen) / 12.5);
    font-weight: normal;
    letter-spacing: 0;
}

.settings-group textarea {
    width: min(100%, calc(var(--screen) * 3.2));
    min-height: calc(var(--screen) * 1.1);
}

.range-input {
    display: flex;
    align-items: center;
    gap: calc(var(--screen) / 22);
}

.range-input .input input {
    width: calc(var(--screen) / 1.6);
}

.range-separator {
    color: var(--ui-muted);
    font-weight: normal;
}

.master-switch .setting-label {
    font-size: calc(var(--screen) / 7.5);
}

.settings-group .center-buttons {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.settings-group .center-buttons .button {
    width: auto;
    height: auto;
    margin: calc(var(--screen) / 18) calc(var(--screen) / 18) 0 0;
    padding: calc(var(--screen) / 20) calc(var(--screen) / 8);
}

/* Shop list cards (cloned by ExpandTable.js); */
.shop-list,
.shop-list tbody,
.shop-list > tbody > tr,
.shop-list > tbody > tr > td {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0;
    backdrop-filter: none !important;
}

.shop-list .data-point {
    margin-bottom: calc(var(--screen) / 12);
    padding: calc(var(--screen) / 18) calc(var(--screen) / 10);
    border-radius: var(--ui-radius);
    background-color: var(--ui-card-bg);
    border: var(--ui-card-border);
    box-shadow: var(--ui-card-edge);
}

.shop-list .data-point .controller-name {
    color: var(--ui-ink);
    font-size: calc(var(--screen) / 8);
}

.element-button {
    border-radius: 50% !important;
}

@media (prefers-reduced-motion: reduce) {
    #options-panel,
    #background,
    #star-pattern {
        translate: none !important;
        transition: none;
    }
}

/* Phones: no mouse, so no parallax; groups and rows stack; */
@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    #options-panel {
        translate: none;
        border-radius: 18px;
    }

    #background {
        background-size: cover;
        background-position: center;
    }

    .refreshed-page .right-column {
        padding: 10px 6px;
    }

    .page-hero,
    .panel-heading.with-actions {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 12px;
    }

    .page-hero h1 {
        font-size: 44px !important;
    }

    .page-hero p,
    .panel-heading p,
    .settings-group header p {
        font-size: 14px;
    }

    .panel-heading {
        text-align: center;
    }

    .panel-heading h2 {
        font-size: 26px !important;
    }

    .panel-heading .center-buttons {
        justify-content: center;
    }

    .panel-heading .center-buttons .button {
        min-width: 0;
        margin: 4px;
        padding: 10px 14px;
    }

    .status-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .status-chip {
        max-width: none;
        padding: 8px 10px;
    }

    .status-chip small {
        font-size: 11px;
    }

    .status-chip strong {
        font-size: 14px;
    }

    .settings-group {
        margin-bottom: 12px;
        padding: 10px 14px;
    }

    .settings-group header h4,
    .master-switch .setting-label {
        font-size: 18px;
    }

    .settings-group .table tr {
        padding: 12px 0 !important;
    }

    .setting-hint {
        font-size: 13px;
    }

    .settings-group .table td:last-child {
        flex: 0 0 auto;
    }

    /* Wide controls drop under their label; */
    .settings-group .table tr:has(textarea) td,
    .settings-group .table tr:has(.range-input) td,
    .settings-group .table tr:has(select) td {
        flex: 1 1 100%;
        justify-content: stretch;
    }

    .settings-group textarea {
        width: 100%;
    }

    .range-input {
        width: 100%;
    }

    .range-input .input {
        flex: 1;
    }

    .range-input .input input {
        width: 100%;
        min-width: 0;
    }

    .settings-group .center-buttons .button {
        flex: 1 1 40%;
        margin: 8px 4px 0;
    }
}

/* Section titles are centered; */
.panel-heading,
.settings-group header {
    text-align: center;
}

.panel-heading.with-actions {
    flex-direction: column;
    align-items: center;
}

.panel-heading.with-actions .center-buttons {
    justify-content: center;
}

.panel-heading .center-buttons .button {
    margin: 0 4px;
}

/*////////////////////////////////////////////////////////////////////////*/
/* Quicklinks dock (left edge): white buttons on a blue tab, like the original; */

.shortcut-table {
    left: 0;
    transform: translateY(-50%);
    padding: calc(var(--screen) / 18) calc(var(--screen) / 18) calc(var(--screen) / 18) calc(var(--screen) / 14);
    border-spacing: 0 calc(var(--screen) / 22);
    background-color: var(--ui-sidebar-bg);
    border-radius: 0 calc(var(--screen) / 6) calc(var(--screen) / 6) 0;
    filter: none;
}

.shortcut-table tr,
.shortcut-table tr:hover {
    display: flex;
    align-items: center;
    animation: none;
    background: transparent;
    transform: none;
}

.shortcut-table td,
.shortcut-table .table-row-border,
.shortcut-table tr:hover .table-row-border {
    padding: 0;
    border: none;
    background: transparent;
}

.shortcut-table .table-row-corner,
.shortcut-table tr:hover .table-row-corner {
    order: -1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--screen) / 3.3);
    height: calc(var(--screen) / 3.3);
    box-sizing: border-box;
    border-radius: 50%;
    background-color: var(--ui-raised-bg);
    border: var(--ui-raised-border);
    cursor: pointer;
}

.shortcut-table tr:hover .table-row-corner {
    background-color: var(--ui-hover-bg);
    border: var(--ui-hover-border);
    transform: scale(1.06);
}

.shortcut-table .table-row-border img {
    width: 60%;
    height: 60%;
    max-width: none;
    padding: 0;
    object-fit: contain;
}

/* The label floats out beside the icon on hover; */
.shortcut-table td:not(.table-row-corner) {
    position: absolute;
    left: calc(100% + 8px);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-6px);
    transition: opacity 0.2s ease, transform 0.35s var(--spring);
}

.shortcut-table tr {
    position: relative;
}

.shortcut-table tr:hover td:not(.table-row-corner) {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.shortcut-table a {
    display: block;
    padding: calc(var(--screen) / 24) calc(var(--screen) / 10);
    white-space: nowrap;
    color: var(--ui-raised-ink);
    font-size: calc(var(--screen) / 10);
    border-radius: 999px;
    background-color: var(--ui-float-bg);
    border: var(--ui-float-border);
    backdrop-filter: var(--ui-float-blur);
    -webkit-backdrop-filter: var(--ui-float-blur);
}

/*////////////////////////////////////////////////////////////////////////*/
/* Glass where there's something behind to see: dropdowns and the scroll hint; */

.hover-menu,
.hover-submenu {
    background-color: rgba(72, 194, 242, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: var(--ui-float-blur);
    -webkit-backdrop-filter: var(--ui-float-blur);
}

[data-theme="dark"] .hover-menu,
[data-theme="dark"] .hover-submenu {
    background-color: rgba(26, 111, 150, 0.82);
}

/* The mouse light: rows and cards brighten softly near the cursor; */
.lit {
    background-image: radial-gradient(circle 160px at var(--lx, -999px) var(--ly, -999px), var(--light-fill), transparent 70%);
}

/*////////////////////////////////////////////////////////////////////////*/
/* Scroll-wheel hint (common/layout.js); */

@keyframes scrollWheel {
    0% { transform: translateY(0); opacity: 1; }
    70% { transform: translateY(6px); opacity: 0; }
    100% { transform: translateY(0); opacity: 0; }
}

/* Bottom center of the panel; each section leaves room for it below its last row; */
.scroll-hint {
    position: absolute;
    bottom: 12px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px 7px 12px;
    overflow: hidden;

    font-family: "Cabin Condensed";
    color: var(--ui-raised-ink);
    background-color: var(--ui-float-bg);
    border: var(--ui-float-border);
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    backdrop-filter: var(--ui-float-blur);
    -webkit-backdrop-filter: var(--ui-float-blur);
    cursor: pointer;

    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.scroll-hint.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.scroll-hint-mouse {
    display: flex;
    justify-content: center;
    width: 17px;
    height: 26px;
    padding-top: 5px;
    box-sizing: border-box;
    border: 2px solid var(--ui-accent);
    border-radius: 8px;
}

.scroll-hint-mouse span {
    width: 2px;
    height: 5px;
    border-radius: 2px;
    background: var(--ui-accent);
    animation: scrollWheel 1.6s ease-in-out infinite;
}

.scroll-hint-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    text-align: left;
    white-space: nowrap;
}

.scroll-hint-text small {
    color: var(--ui-muted);
    font-size: 11px;
}

.scroll-hint-text strong {
    font-size: 14px;
}

/* Room under each section's last row for the hint; panels are display: inline, so it's a spacer; */
.refreshed-page .right-column::after {
    content: "";
    display: block;
    flex: none;
    min-height: 58px;
}

/* Fills as the wheel pushes past the end of the section; */
.scroll-hint-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: var(--ui-accent);
    transform: scaleX(var(--progress, 0));
    transform-origin: left;
    transition: transform 0.12s linear;
}



@media (prefers-reduced-motion: reduce) {
    .scroll-hint-mouse span {
        animation: none;
    }
}


#options-panel {
    isolation: isolate;
}

/*////////////////////////////////////////////////////////////////////////*/
/* Gummy feel: controls squash when pressed and spring back, menus pop, sections and rows ease in; */

.button,
.autobuyerButton,
.image-button,
.status-chip,
.shortcut-table .table-row-corner {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.45s var(--spring);
}

.button:hover,
.autobuyerButton:hover {
    transform: scale(1.03);
}

.button:active,
.autobuyerButton:active,
.shortcut-table .table-row-corner:active {
    transform: scale(0.95);
    transition-duration: 0.2s, 0.2s, 0.2s, 0.08s;
}

/* Toggles: the knob springs across and stretches while held, like a gummy; */
.slider:before {
    transition: transform 0.45s var(--spring), width 0.25s var(--spring);
}

.switch:active .slider:before {
    width: calc(var(--slider-knob-size) + 8px);
}

.switch:active input:checked + .slider:before {
    transform: translateX(calc(var(--switch-width) - var(--switch-height) - 8px));
}

/* Fields swell slightly when focused; */
.input {
    transition: transform 0.4s var(--spring), box-shadow 0.25s ease;
}

.input:focus-within {
    transform: scale(1.03);
}

/* Toolbar dropdowns pop open; */
@keyframes menuPop {
    0% { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(0.92); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.hover-menu {
    transform-origin: top center;
    animation: menuPop 0.35s var(--spring);
}

/* Section changes: the new section's cards arrive one after another; */
@keyframes panelForward {
    from { opacity: 0; transform: translateY(22px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

@keyframes panelBack {
    from { opacity: 0; transform: translateY(-22px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.right-column > .panel-forward > *,
.right-column > .panel-back > * {
    animation-duration: 0.5s;
    animation-timing-function: var(--spring);
    animation-fill-mode: both;
}

.right-column > .panel-forward > :nth-child(2), .right-column > .panel-back > :nth-child(2) { animation-delay: 0.05s; }
.right-column > .panel-forward > :nth-child(3), .right-column > .panel-back > :nth-child(3) { animation-delay: 0.1s; }
.right-column > .panel-forward > :nth-child(4), .right-column > .panel-back > :nth-child(4) { animation-delay: 0.15s; }
.right-column > .panel-forward > :nth-child(n + 5), .right-column > .panel-back > :nth-child(n + 5) { animation-delay: 0.2s; }

/* Rows pop in when they're shown (e.g. turning on a setting reveals its options),
   and drift up into place as they scroll into view; */
@keyframes rowShow {
    from { opacity: 0; scale: 0.97; }
    to { opacity: 1; scale: 1; }
}

@keyframes rowScrollIn {
    from { translate: 0 18px; }
    to { translate: 0 0; }
}

.settings-group .table tr,
.shop-list .data-point {
    animation: rowShow 0.35s var(--spring), rowScrollIn linear both;
    animation-timeline: auto, view();
    animation-range: normal, entry 0% entry 60%;
}

/* Shop cards and the scroll hint bounce a little too; */
.scroll-hint {
    transition: opacity 0.25s ease, transform 0.45s var(--spring);
}

@media (prefers-reduced-motion: reduce) {
    .button, .autobuyerButton, .image-button, .status-chip, .input, .slider:before,
    .hover-menu, .settings-group .table tr, .shop-list .data-point {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    .hover-menu {
        animation: menuPop 0.35s var(--spring);
    }
}

/*////////////////////////////////////////////////////////////////////////*/
/* Power switches: a softly shaded track with an I or O mark, and a knob that springs across; */

.slider {
    background: linear-gradient(180deg, #ccd3d8, #d6dce0);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

input:checked + .slider {
    background: linear-gradient(180deg, #22b2f2, #33c1fb);
    box-shadow: inset 0 1px 2px rgba(0, 60, 100, 0.15);
}

input:checked + .slider-danger {
    background: linear-gradient(180deg, #f6485a, #ff5f6d);
    box-shadow: inset 0 1px 2px rgba(100, 0, 10, 0.15);
}

.slider:before {
    z-index: 1;
    background: linear-gradient(180deg, #ffffff, #edf2f5);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22), inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

/* O on the empty side when off, I when on; */
.slider:after {
    content: "";
    position: absolute;
    top: 50%;
    right: calc(var(--switch-height) * 0.36);
    width: calc(var(--switch-height) * 0.26);
    height: calc(var(--switch-height) * 0.26);
    border: 2px solid rgba(82, 82, 82, 0.45);
    border-radius: 50%;
    transform: translateY(-50%);
    transition: opacity 0.2s ease;
}

input:checked + .slider:after {
    right: auto;
    left: calc(var(--switch-height) * 0.42);
    width: 2px;
    height: calc(var(--switch-height) * 0.34);
    border: none;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .slider {
    background: linear-gradient(180deg, #2b4256, #30495e);
}

[data-theme="dark"] .slider:after {
    border-color: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] input:checked + .slider {
    background: linear-gradient(180deg, #1a96cd, #1fa6e0);
}

[data-theme="dark"] input:checked + .slider-danger {
    background: linear-gradient(180deg, #d4434f, #e0505c);
}

/* Fields: a subtle gradient rim and well; */
.input,
select {
    background: linear-gradient(180deg, #2fc1fd, #1db5f4);
}

.input input,
.input select {
    background: linear-gradient(180deg, #ffffff, #f8fbfd);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .input,
[data-theme="dark"] select {
    background: linear-gradient(180deg, #1e98cb, #1a8cbd);
}

[data-theme="dark"] .input input,
[data-theme="dark"] .input select {
    background: linear-gradient(180deg, #0f1d2a, #12212f);
}

/*////////////////////////////////////////////////////////////////////////*/
/* Bubbly glass on the floating pieces: rounder, with a curved highlight across the top; */

.hover-menu,
.hover-submenu,
.scroll-hint,
.shortcut-table a{
    background-image: radial-gradient(130% 70% at 50% -10%, rgba(255, 255, 255, 0.55), transparent 62%);
}

.hover-menu,
.hover-submenu {
    border-radius: calc(var(--screen) / 8);
    padding: 10px;
}

[data-theme="dark"] .hover-menu,
[data-theme="dark"] .scroll-hint,
[data-theme="dark"] .shortcut-table a {
    background-image: radial-gradient(130% 70% at 50% -10%, rgba(255, 255, 255, 0.12), transparent 62%);
}

/*////////////////////////////////////////////////////////////////////////*/
/* Selection slab: springs to the row under the mouse or picked with the arrow keys (common/layout.js); */

.settings-group {
    position: relative;
}

.settings-group > header,
.settings-group > .table {
    position: relative;
    z-index: 1;
}

.row-slab {
    position: absolute;
    top: 0;
    left: calc(var(--screen) / 22);
    right: calc(var(--screen) / 22);
    z-index: 0;
    border-radius: calc(var(--screen) / 12);
    background-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    opacity: 0;
    transition: transform 0.4s var(--spring), height 0.3s var(--spring), opacity 0.2s ease;
    pointer-events: none;
}

.row-slab::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 24%;
    bottom: 24%;
    width: 4px;
    border-radius: 4px;
    background: var(--ui-accent);
}

.settings-group.has-active-row .row-slab {
    opacity: 1;
}

[data-theme="dark"] .row-slab {
    background-color: #284660;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.settings-group .table tr .setting-label,
.settings-group .table tr .setting-hint {
    transition: transform 0.35s var(--spring), color 0.2s ease;
}

.settings-group .table tr.row-active .setting-label {
    color: var(--ui-accent);
    transform: translateX(8px);
}

.settings-group .table tr.row-active .setting-hint {
    transform: translateX(8px);
}

/* Dividers fade where the slab sits; */
.settings-group .table tr.row-active,
.settings-group .table tr:has(+ tr.row-active) {
    border-bottom-color: transparent;
}

/*////////////////////////////////////////////////////////////////////////*/
/* Home: the title, the main switch, then the page's sections side by side (common/layout.js); */

.home-landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    max-width: calc(var(--screen) * 6.2);
    margin: 0 auto;
    text-align: center;
}

.home-landing h1 {
    margin: 0 !important;
    font-size: calc(var(--screen) / 1.6) !important;
    letter-spacing: -2px;
    line-height: 1;
}

.home-landing h2 {
    margin: 4px 0 calc(var(--screen) / 9) !important;
    color: var(--ui-accent) !important;
    font-size: calc(var(--screen) / 8) !important;
}

.home-card {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: calc(var(--screen) / 14);
    text-align: left;
}

.home-sections {
    display: grid;
    grid-template-columns: repeat(var(--section-columns, 3), minmax(0, 1fr));
    gap: calc(var(--screen) / 14);
    width: 100%;
    text-align: left;
}

.home-section {
    margin: 0;
}

.home-item {
    cursor: pointer;
}

.home-item td:first-child {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: calc(var(--screen) / 14);
    align-items: center;
}

.home-item img {
    grid-row: span 2;
    width: calc(var(--screen) / 5.5);
    height: calc(var(--screen) / 5.5);
    object-fit: contain;
    transition: transform 0.4s var(--spring);
}

[data-theme="dark"] .home-item img {
    filter: brightness(0) invert(0.88);
}

.home-item.row-active img {
    transform: rotate(-12deg) scale(1.08);
}

.home-item-arrow::before {
    content: "\203A";
    color: var(--ui-accent);
    font-size: calc(var(--screen) / 5);
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.35s var(--spring);
    display: inline-block;
    transform: translateX(-6px);
}

.home-item.row-active .home-item-arrow::before {
    opacity: 1;
    transform: translateX(0);
}

/* Rows whose control is a set of buttons; */
.settings-group .table td.row-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: calc(var(--screen) / 22);
}

.row-buttons .button {
    width: auto;
    height: auto;
    margin: 0;
    padding: calc(var(--screen) / 24) calc(var(--screen) / 9);
    font-size: calc(var(--screen) / 10);
}

.row-buttons a {
    display: contents;
}

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    .home-landing h1 {
        font-size: 48px !important;
    }

    .home-landing h2 {
        font-size: 16px !important;
        margin-bottom: 16px !important;
    }

    .home-sections {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .home-item img {
        width: 30px;
        height: 30px;
    }

}

@media (prefers-reduced-motion: reduce) {
    .row-slab, .home-item img {
        animation: none !important;
        transition: none !important;
    }
}

/*////////////////////////////////////////////////////////////////////////*/
/* Titles: the subtitle sits in its own frame so it never runs into the title; */

.home-landing h1 {
    line-height: 1.12;
}

/* The subtitle is a band across the whole panel, painted outside its box so it adds no scrolling; */
.home-landing h2 {
    align-self: stretch;
    margin: calc(var(--screen) / 14) 0 calc(var(--screen) / 8) !important;
    padding: calc(var(--screen) / 26) 0;
    font-size: calc(var(--screen) / 10) !important;
    color: var(--ui-accent) !important;
    border-image: linear-gradient(to bottom, rgba(19, 176, 243, 0.35) 1px, rgba(19, 176, 243, 0.1) 1px calc(100% - 1px), rgba(19, 176, 243, 0.35) calc(100% - 1px)) fill 0 / 0 / 0 100vw;
}

[data-theme="dark"] .home-landing h2 {
    border-image: linear-gradient(to bottom, rgba(76, 198, 255, 0.35) 1px, rgba(76, 198, 255, 0.1) 1px calc(100% - 1px), rgba(76, 198, 255, 0.35) calc(100% - 1px)) fill 0 / 0 / 0 100vw;
}

.panel-heading h2 {
    line-height: 1.15;
}

/* A short accent bar between a section's title and its description; */
.panel-heading p {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--screen) / 22);
    margin-top: calc(var(--screen) / 30);
}

.panel-heading p::before {
    content: "";
    width: calc(var(--screen) / 3.5);
    height: 4px;
    border-radius: 4px;
    background: var(--ui-accent);
    opacity: 0.8;
}

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    .home-landing h2 {
        font-size: 14px !important;
        padding: 6px 0;
    }
}

/*////////////////////////////////////////////////////////////////////////*/
/* Header text: a subtle gradient; */

.home-landing h1,
.panel-heading h2 {
    background: linear-gradient(180deg, #33c4fd 20%, #1fb1f1 90%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
}

[data-theme="dark"] .home-landing h1,
[data-theme="dark"] .panel-heading h2 {
    background: linear-gradient(180deg, #5fd0ff 20%, #45bff6 90%);
    -webkit-background-clip: text;
    background-clip: text;
}

/* Sidebar tabs keep their original pill shape; the dock and shop buttons stay round; */
.image-button {
    border-radius: calc(var(--screen) / 5);
}

.shortcut-table .table-row-corner,
.element-button {
    border-radius: 50%;
}

/*////////////////////////////////////////////////////////////////////////*/
/* Click accent: three little rounded strokes that pop at a field's corner (common/layout.js); */

@keyframes clickAccent {
    0% { opacity: 0; transform: scale(0.4); }
    35% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0; transform: scale(1); }
}

.field-burst {
    position: fixed;
    z-index: 100;
    width: 30px;
    height: 30px;
    color: var(--ui-accent);
    pointer-events: none;
    transform-origin: 100% 100%;
    animation: clickAccent 0.38s var(--spring) forwards;
}

.field-burst svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* A calm focus ring instead of the bright glow; */
.input:not(.danger-input) input:focus,
.input:not(.danger-input) select:focus {
    box-shadow: inset 0 0 0 2px rgba(19, 176, 243, 0.35) !important;
}

.danger-input input:focus,
.danger-input select:focus {
    box-shadow: inset 0 0 0 2px rgba(255, 81, 95, 0.4) !important;
}

[data-theme="dark"] .input:not(.danger-input) input:focus,
[data-theme="dark"] .input:not(.danger-input) select:focus {
    box-shadow: inset 0 0 0 2px rgba(76, 198, 255, 0.3) !important;
}

.input:focus-within {
    box-shadow: 0 0 0 3px rgba(19, 176, 243, 0.14);
}

[data-theme="dark"] .input:focus-within {
    box-shadow: 0 0 0 3px rgba(76, 198, 255, 0.1);
}

@media (prefers-reduced-motion: reduce) {
    .field-burst {
        display: none;
    }
}

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    .settings-group .table tr:has(.row-buttons) td {
        flex: 1 1 100%;
    }

    .settings-group .table td.row-buttons {
        justify-content: stretch;
    }

    .row-buttons .button {
        flex: 1 1 auto;
        min-width: 0;
        padding: 10px 12px;
        font-size: 15px;
    }
}

/* No wheel on phones, so no scroll hint; */
@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    .scroll-hint {
        display: none;
    }
}

/*////////////////////////////////////////////////////////////////////////*/
/* Phones: BAI-kun sits in the footer's right corner, across from the manual; */

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    #baikun-container {
        z-index: 7;
    }

    #bottom-text-warning {
        padding: 0 64px;
    }

    #version-text {
        justify-content: center;
        transform: translateY(-3px);
        opacity: 0.85;
    }
}

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    /* No scroll hint on phones, so only a little room after the last group; */
    .refreshed-page .right-column::after {
        min-height: 12px;
    }
}

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    /* Settings fade softly under the tab row and above the footer instead of being cut off; */
    .refreshed-page .right-column {
        -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
        mask-image: linear-gradient(180deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
    }
}

/* The last row still showing has no divider, even when the rows after it are hidden; */
.settings-group .table tr:not(:has(~ tr:not(.hidden, [style*="display: none"]))) {
    border-bottom: none;
}

/*////////////////////////////////////////////////////////////////////////*/
/* Switches read ON and OFF on their empty side; */

.slider:after,
input:checked + .slider:after {
    content: "OFF";
    top: 0;
    bottom: 0;
    left: var(--switch-height);
    right: calc(var(--switch-height) * 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    border: none;
    border-radius: 0;
    background: none;
    transform: none;
    font-size: calc(var(--switch-height) * 0.36);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    color: rgba(82, 82, 82, 0.55);
    user-select: none;
    pointer-events: none;
}

input:checked + .slider:after {
    content: "ON";
    left: calc(var(--switch-height) * 0.08);
    right: var(--switch-height);
    color: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .slider:after {
    color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] input:checked + .slider:after {
    color: rgba(255, 255, 255, 0.95);
}

/*////////////////////////////////////////////////////////////////////////*/
/* Night: the checkered background, inverted (dark floor, light checks, dark edges); */

[data-theme="dark"] #background {
    background-image: none !important;
    background-color: #0d1a26;
    background-blend-mode: normal;
}

[data-theme="dark"] #background::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("resources/BG.png");
    background-repeat: no-repeat;
    background-size: inherit;
    background-position: inherit;
    filter: invert(1) brightness(2.4);
    mix-blend-mode: screen;
    pointer-events: none;
}

/*////////////////////////////////////////////////////////////////////////*/
/* Phones: the manual tab tucks into the footer's corner, and controls that drop onto
   their own line are centered (rows marked by MarkWrappedRows in common/layout.js); */

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    #manual-wrapper {
        bottom: calc(var(--screen-scale) * -0.3);
    }

    #manual-wrapper:hover {
        bottom: calc(var(--screen-scale) * -0.3 + 4px);
    }

    .table tr.row-wrapped > td:not(:first-child) {
        flex: 1 1 100%;
        justify-content: center;
        text-align: center;
    }
}

/*////////////////////////////////////////////////////////////////////////*/
/* The tab names only show while the sidebar is open, so no letters peek past a closed button's edge; */

.left-column:not(:hover) .image-button {
    color: transparent;
}

/*////////////////////////////////////////////////////////////////////////*/
/* Textareas look like the other fields: the blue gradient rim around a soft white well; */

.right-column textarea {
    box-sizing: border-box;
    padding: 12px 16px;
    border: 3px solid transparent;
    border-radius: 18px;
    background:
        linear-gradient(180deg, #ffffff, #f8fbfd) padding-box,
        linear-gradient(180deg, #2fc1fd, #1db5f4) border-box;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    color: var(--ui-field-ink);
    font-size: calc(var(--screen) / 10);
    font-weight: bold;
    line-height: 1.35;
    transition: box-shadow 0.25s ease;
}

.right-column textarea::placeholder {
    color: var(--ui-muted);
    font-weight: normal;
}

.right-column textarea:focus {
    border-color: transparent;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05), 0 0 0 3px rgba(19, 176, 243, 0.14);
}

/* A slim blue scrollbar that sits inside the well (its width also sizes the resize grip); */
.right-column textarea::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

.right-column textarea::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}

.right-column textarea::-webkit-scrollbar-thumb {
    border: 5px solid transparent;
    border-radius: 10px;
    background: #8fdcfb padding-box;
}

.right-column textarea::-webkit-scrollbar-thumb:hover {
    background: #13b0f3 padding-box;
}

[data-theme="dark"] .right-column textarea {
    background:
        linear-gradient(180deg, #0f1d2a, #12212f) padding-box,
        linear-gradient(180deg, #1e98cb, #1a8cbd) border-box;
}

[data-theme="dark"] .right-column textarea:focus {
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05), 0 0 0 3px rgba(76, 198, 255, 0.1);
}

[data-theme="dark"] .right-column textarea::-webkit-scrollbar-thumb {
    background: #2a6f92 padding-box;
}

[data-theme="dark"] .right-column textarea::-webkit-scrollbar-thumb:hover {
    background: #3ac7ff padding-box;
}

/*////////////////////////////////////////////////////////////////////////*/
/* BAI-kun's speech bubble: tinted liquid glass, the page softly blurred behind it, with a curved
   highlight across the top and a light rim; the text keeps a soft shadow so it always reads; */

#baikun-speech-bubble {
    background-color: rgba(52, 186, 238, 0.58);
    background-image:
        radial-gradient(120% 60% at 50% -8%, rgba(255, 255, 255, 0.5), transparent 60%),
        radial-gradient(90% 50% at 50% 115%, rgba(255, 255, 255, 0.16), transparent 70%);
    backdrop-filter: blur(24px) saturate(170%);
    -webkit-backdrop-filter: blur(24px) saturate(170%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: calc(var(--screen) / 5);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.75),
        inset 0 -1px 0 rgba(255, 255, 255, 0.25),
        0 10px 28px rgba(0, 70, 110, 0.16);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 70, 110, 0.35);
}

#baikun-speech-bubble-name-handle {
    background-color: rgba(24, 163, 217, 0.82);
    background-image: radial-gradient(120% 80% at 50% -20%, rgba(255, 255, 255, 0.45), transparent 60%);
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 4px 12px rgba(0, 70, 110, 0.14);
    text-shadow: 0 1px 2px rgba(0, 70, 110, 0.3);
}

[data-theme="dark"] #baikun-speech-bubble {
    background-color: rgba(26, 110, 155, 0.55);
    background-image:
        radial-gradient(120% 60% at 50% -8%, rgba(255, 255, 255, 0.2), transparent 60%),
        radial-gradient(90% 50% at 50% 115%, rgba(255, 255, 255, 0.06), transparent 70%);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 10px 28px rgba(0, 0, 0, 0.35);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] #baikun-speech-bubble-name-handle {
    background-color: rgba(26, 111, 150, 0.85);
    background-image: radial-gradient(120% 80% at 50% -20%, rgba(255, 255, 255, 0.2), transparent 60%);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.3);
}

/*////////////////////////////////////////////////////////////////////////*/
/* Shop cards: an open card's header sits above a divider, and its settings are grouped under small
   section names, like the cards on the other pages; */

.shop-list .data-point:has(> .table:not(.hidden)) .controller-container {
    padding-bottom: calc(var(--screen) / 22);
    border-bottom: 1px solid var(--ui-divider);
}

.shop-list .data-point .table tr.shop-subhead {
    padding: calc(var(--screen) / 9) 0 calc(var(--screen) / 40) !important;
    border-bottom: none;
}

.shop-list .data-point .table tr.shop-subhead td {
    flex: 1 1 100%;
    justify-content: flex-start;
    color: var(--ui-accent);
    font-size: calc(var(--screen) / 9.5);
    font-weight: bold;
    letter-spacing: 0;
}

.shop-list .data-point .table tr:has(+ tr.shop-subhead:not(.hidden)) {
    border-bottom: none;
}

/* The last row still showing has no divider, in shop cards too; */
.shop-list .data-point .table tr:not(:has(~ tr:not(.hidden, [style*="display: none"]))) {
    border-bottom: none;
}

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    .shop-list .data-point {
        padding: 12px 14px;
    }

    .shop-list .data-point .table tr {
        flex-wrap: wrap;
        padding: 12px 0 !important;
    }

    .shop-list .data-point .table tr.shop-subhead {
        padding: 18px 0 2px !important;
    }

    .shop-list .data-point .table tr:has(.range-input) td,
    .shop-list .data-point .table tr:has(select) td {
        flex: 1 1 100%;
        justify-content: center;
    }
}

/* The default card (no on/off switch) says what it's for; */
.shop-list .data-point:has(.enabler-container.hidden) .controller-name::after {
    content: "Used by every shop that has no card of its own.";
    display: block;
    color: var(--ui-muted);
    font-size: calc(var(--screen) / 12.5);
    font-weight: normal;
}

.shop-list .data-point:has(.enabler-container.hidden) .controller-name {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.shop-list .data-point .controller-container {
    align-items: center;
}

.shop-list .data-point .element-buttons {
    display: flex;
    flex: none;
    gap: 6px;
}

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    /* The round header buttons keep their size instead of the wide phone button rule; */
    .shop-list .data-point .element-button {
        width: 38px;
        min-width: 0;
        height: 38px;
        min-height: 0;
        margin: 0;
        padding: 0;
    }
}

/*////////////////////////////////////////////////////////////////////////*/
/* Pager: First, Previous, the page count, Next and Last on their own centered line above the data
   (DisplayChunkData.js shows, hides and disables them); */

.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: calc(var(--screen) / 22);
    margin: calc(var(--screen) / 22) 0 calc(var(--screen) / 14);
}

.right-column .pager .pager-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--screen) / 3.6);
    min-width: 0;
    height: calc(var(--screen) / 3.6);
    min-height: 0;
    margin: 0;
    padding: 0;
    border-radius: 50%;
}

/* A block icon: the pager script shows buttons with display: initial, which drops the flex centering,
   and an inline icon would then sit on the text baseline, a little high; */
.pager-button svg {
    display: block;
    margin: 0 auto;
    width: 55%;
    height: 55%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pager-button:disabled {
    opacity: 0.4;
    cursor: default;
    transform: none !important;
}

.pager .pager-count {
    min-width: calc(var(--screen) * 0.9);
    margin: 0 calc(var(--screen) / 30);
    color: var(--ui-ink);
    font-size: calc(var(--screen) / 9.5);
    font-weight: bold;
    text-align: center;
}

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    .right-column .pager .pager-button {
        width: 42px;
        height: 42px;
    }

    .pager .pager-count {
        min-width: 0;
        font-size: 15px;
    }
}

/* Generated data tables inside a card keep even columns and a rounded header; */
.settings-group #table-container .table td:last-child {
    flex: 2;
    justify-content: center;
}

.settings-group #table-container thead tr {
    padding-right: 10px !important;
}

/* Row colors, readable on the night theme too; */
.settings-group #table-container tr.item {
    border-radius: calc(var(--screen) / 14);
}

[data-theme="dark"] table:not(.ignore-alternate-rows) tr.checked-row { background-color: rgba(92, 214, 120, 0.2); }
[data-theme="dark"] table:not(.ignore-alternate-rows) tr.battledome-row { background-color: rgba(255, 100, 110, 0.2); }
[data-theme="dark"] table:not(.ignore-alternate-rows) tr.quest-row { background-color: rgba(255, 166, 77, 0.2); }
[data-theme="dark"] table:not(.ignore-alternate-rows) tr.deposit-row { background-color: rgba(90, 150, 255, 0.22); }
[data-theme="dark"] table:not(.ignore-alternate-rows) tr.gallery-row { background-color: rgba(240, 230, 90, 0.17); }

/* A small key for the row colors; */
.row-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 8px;
    margin-top: calc(var(--screen) / 20);
}

.legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--ui-card-bg);
    color: var(--ui-ink);
    font-size: calc(var(--screen) / 13);
    font-weight: bold;
}

.legend-chip::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--chip);
}

.stock-chip { --chip: #8fe57c; }
.battledome-chip { --chip: #ff8a8a; }
.quest-chip { --chip: #ffc27a; }
.deposit-chip { --chip: #7fb0ff; }
.gallery-chip { --chip: #ece35f; }

/*////////////////////////////////////////////////////////////////////////*/
/* Toolbar arrows flip up while their menu is open and spring back when it closes (common/layout.js); */

.navigation-container .dropdown-arrow {
    transition: transform 0.45s var(--spring);
}

.navigation-container.menu-open .dropdown-arrow {
    transform: translate(32%, 40%) rotate(180deg);
}

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    .navigation-container.menu-open .dropdown-arrow {
        transform: rotate(180deg);
    }
}

/* Toolbar arrows keep their shape in any window: both sides follow the same scale (same size at 16:9); */
@media (min-width: 769px), (min-aspect-ratio: 4001/5000) {
    .dropdown-arrow {
        width: calc(var(--screen) / 8.7);
        height: calc(var(--screen) / 14.4);
    }
}

/* Desktop windows: the scale never grows past what the width allows, so tall windows (portrait
   monitors, a browser snapped to half the screen) don't blow the toolbar up. Phones keep their own sizes; */
@media (min-width: 769px), (min-aspect-ratio: 4001/5000) {
    :root {
        --screen: min(calc(6.103vw + 10.807vh), 14vw);
    }

    #autobuyer-logo {
        width: min(23vh, 15vw);
    }
}

/* Phones: BAI-kun's canvas runs past the right edge; clip (not hidden) so nothing can scroll the page sideways to it; */
@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    #background {
        overflow: clip;
    }
}

/*////////////////////////////////////////////////////////////////////////*/
/* Tick boxes: a rounded well with the field's blue rim; checking fills it and pops in a check mark; */

.right-column input[type="checkbox"]:not(.switch input) {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: none;
    width: 24px;
    height: 24px;
    margin: 0;
    border: 2px solid #2fc1fd;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff, #f4f9fc);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    vertical-align: middle;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.35s var(--spring);
}

.right-column input[type="checkbox"]:not(.switch input):hover {
    border-color: #13b0f3;
    transform: scale(1.06);
}

.right-column input[type="checkbox"]:not(.switch input):active {
    transform: scale(0.9);
}

.right-column input[type="checkbox"]:not(.switch input)::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 80% no-repeat;
    opacity: 0;
    transform: scale(0.4) rotate(-12deg);
    transition: opacity 0.15s ease, transform 0.35s var(--spring);
}

.right-column input[type="checkbox"]:not(.switch input):checked {
    border-color: #13b0f3;
    background: linear-gradient(180deg, #33c4fd, #13b0f3);
}

.right-column input[type="checkbox"]:not(.switch input):checked::after {
    opacity: 1;
    transform: none;
}

.right-column input[type="checkbox"]:not(.switch input):focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(19, 176, 243, 0.2);
}

[data-theme="dark"] .right-column input[type="checkbox"]:not(.switch input) {
    border-color: #1e98cb;
    background: linear-gradient(180deg, #0f1d2a, #12212f);
}

[data-theme="dark"] .right-column input[type="checkbox"]:not(.switch input):checked {
    border-color: #3ac7ff;
    background: linear-gradient(180deg, #2aa9e0, #1a96cd);
}

/*////////////////////////////////////////////////////////////////////////*/
/* Textarea resize grip: two short rounded strokes in the field's blue, tucked into the rounded corner; */

.right-column textarea::-webkit-resizer {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M12.5 3.5L3.5 12.5M12.5 8.5L8.5 12.5' fill='none' stroke='%2313b0f3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") 0 0 / 100% no-repeat;
}

[data-theme="dark"] .right-column textarea::-webkit-resizer {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M12.5 3.5L3.5 12.5M12.5 8.5L8.5 12.5' fill='none' stroke='%233ac7ff' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* The scroll hint scales with the rest of the page, so zooming (or a small window) keeps it in proportion
   (same size as before at 1366x768); */
.scroll-hint {
    bottom: calc(var(--screen) / 13.8);
    gap: calc(var(--screen) / 16.6);
    padding: calc(var(--screen) / 23.7) calc(var(--screen) / 10.4) calc(var(--screen) / 23.7) calc(var(--screen) / 13.8);
}

.scroll-hint-mouse {
    width: calc(var(--screen) / 9.8);
    height: calc(var(--screen) / 6.4);
    padding-top: calc(var(--screen) / 33);
    border-radius: calc(var(--screen) / 20.8);
}

.scroll-hint-mouse span {
    height: calc(var(--screen) / 33);
}

.scroll-hint-text small {
    font-size: calc(var(--screen) / 15.1);
}

.scroll-hint-text strong {
    font-size: calc(var(--screen) / 11.9);
}

.refreshed-page .right-column::after {
    min-height: calc(var(--screen) / 2.86);
}

@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    .refreshed-page .right-column::after {
        min-height: 12px;
    }
}

/* Phones: the toolbar's pieces also respect the window's height, so a window just tall enough for the
   phone layout can't push them into the teeth or the tab row (same sizes on a normal phone); */
@media (max-width: 768px) and (max-aspect-ratio: 4/5) {
    .navigation-container a .navigation-option {
        width: min(7.4vw, 4.6vh);
    }

    .dropdown-arrow {
        width: min(2.6vw, 1.6vh);
    }

    #autobuyer-logo {
        width: min(25vw, 15.5vh);
    }
}

/*////////////////////////////////////////////////////////////////////////*/
/* Theme button (left of the experimental gear): a moon in the light theme, a sun at night; */

#theme-button {
    right: calc(var(--screen) / 0.945);
    cursor: pointer;
}

.round-toolbar-button .toolbar-link .theme-icon {
    height: 70%;
    width: auto;
    pointer-events: none;
}

.theme-icon-sun,
[data-theme="dark"] .theme-icon-moon {
    display: none;
}

[data-theme="dark"] .theme-icon-sun {
    display: block;
}

#theme-button.theme-spin .theme-icon {
    animation: themeSpin 0.55s var(--spring);
}

@keyframes themeSpin {
    from { transform: rotate(-120deg) scale(0.5); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    #theme-button.theme-spin .theme-icon {
        animation: none;
    }
}
