/* hello this is the stylesheet for the boba game
   names are kebab-case here (js stays camelCase), keep it cute and readable */

/* ========================================
   global base stuff
   ======================================== */

html,
body {
    background-color: #ffdb9a;
    font-family: 'Momo Trust Sans', sans-serif;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    max-width: 100vw;
    height: 100%;
}

.momo-trust-sans {
    font-family: "Momo Trust Sans", sans-serif;
    font-optical-sizing: auto;
    font-weight: 500;
    font-style: normal;
}

/* typography defaults */
p,
button {
    color: #bd851d;
    font-size: 1.5rem;
    margin: 1rem 2rem;
}

h3 {
    color: #ffd079;
    margin-left: 2rem;
    padding: 5px;
}

h4 {
    color: #bd851d;
    font-size: 1rem;
    margin: 1rem 0 1rem 2rem;
}

h6 {
    color: #bd851d;
    font-size: 0.8rem;
    margin: 1rem 0 1rem 2rem;
}

hr {
    width: 90%;
    height: 2px;
    background-color: #a0721c;
    margin: 1rem auto;
    border-radius: 1px;
    border: none;
}

.highlight {
    color: #5fb8ff;
    font-weight: bold;
}

/* ========================================
   banner (the big scramble title thing)
   ======================================== */

#banner {
    font-family: 'Space Mono', monospace;
    font-size: clamp(3rem, 10vw, 10rem);
    -webkit-text-stroke: clamp(0.06rem, 0.2vw, 0.2rem) #ea9a08;
    color: #db9b24;
    padding: 0 clamp(1rem, 2vw, 3rem);
    margin: clamp(1rem, 2vw, 3rem) 0;
    border-radius: clamp(0.4rem, 0.75vw, 1rem);
    text-align: center;
    transition: 1s;
}

#banner:hover {
    background-color: #ffd079;
    color: #bd851d;
    transition: 1s;
}

/* ========================================
   widget bars (progress + leaderboard)
   ======================================== */

.widget-container {
    background-color: #bd851d;
    border-radius: 3px;
    margin: 0.5rem auto;
    align-items: center;
    padding: 0.5rem;
    box-sizing: border-box;
    max-width: 100%;
}

.banana {
    display: inline-block;
}

#leaderboard {
    cursor: pointer;
}

.progress-container {
    width: 90%;
    max-width: 90vw;
    background-color: #ffd079;
    border-radius: 5px;
    overflow: hidden;
    margin: 10px auto;
    box-sizing: border-box;
}

.progress-bar {
    width: 0;
    height: 30px;
    background-color: #d49621;
    text-align: center;
    line-height: 30px;
    color: white;
    transition: width 0.4s ease;
}

.widget-container h3 {
    margin: 0.25rem 2rem;
}

#quest-description {
    margin-left: 0;
}

/* ========================================
   buttons (brew, sell, advertise), and tooltip styling
   ======================================== */

.tooltip {
    position: absolute;
    left: calc(100% + 1rem);
    top: 50%;
    transform: translateY(-50%);
    background: #a0721c;
    white-space: normal;
    max-width: 20rem;
    width: max-content;
    padding: 0.5rem;
    line-height: 1.3;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    border-radius: 8px;
    font-size: 0.95rem;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: opacity 120ms ease;
    pointer-events: none;
}

.tooltip-stats,
.tooltip p,
#tab-content-area .tooltip p{
    color: #ffd079;
    font-size: 1rem;
    margin: 0.5rem;
}

.tooltip hr,
#tab-content-area .tooltip hr {
    display: block;
    border: none;
    height: 2px;
    background-color: #db9b24;
    margin: 0.5rem auto;
    width: 90%;
    box-sizing: border-box;
}

.tooltip h3,
#tab-content-area .tooltip h3 {
    margin: 0 0.5rem 0.5rem 0.5rem;
    color: #ffd079;
    text-align: start;
}

.button-wrapper:hover .tooltip,
.button-wrapper button:focus-visible ~ .tooltip {
    visibility: visible;
    opacity: 1;
    transition: opacity 120ms ease;
}

.button-wrapper {
    margin: 1rem 2rem;
    display: block;
    position: relative;
    width: fit-content;
}

.button-wrapper button {
    background-color: #ffd079;
    border: none;
    padding: 1rem 2rem;
    margin: 0;
    border-radius: 0.5rem;
    cursor: pointer;
    font-family: "Momo Trust Sans", sans-serif;
    transition: transform 0.15s ease;
    display: block;
}

.button-wrapper .button-progress-container {
    width: 100%;
    background-color: #ffd079;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 0.5rem;
    height: 20px;
}

.tab-content {
    overflow: visible !important;
    max-height: 70vh !important;
}

#upgrades-container,
#purchased-upgrades-container,
.button-container {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
}

#upgrades-container *:not(hr),
#purchased-upgrades-container *:not(hr) {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

#upgrades-container hr,
#purchased-upgrades-container hr {
    height: 2px !important;
}

.button-progress-bar {
    width: 0;
    height: 20px;
    background-color: #5fb8ff;
    text-align: center;
    line-height: 20px;
    color: white;
    transition: width 0.4s ease;
}

/* ========================================
   game boxes (console + main game area)
   ======================================== */

#game-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 60vh;
    width: calc(100vw - 2rem);
    max-width: calc(100vw - 2rem);
    margin: 1rem;
    gap: 1rem;
    position: relative;
    box-sizing: border-box;
}

.game-box {
    display: inline-block;
}

.dark-bg {
    background-color: #bd851d;
    border-radius: 7px;
    color: #ffdb9a;
    font-family: "Momo Trust Sans", sans-serif;
    padding: 1rem;
    margin: 1rem auto;
}

.dark-bg,
.dark-bg * {
    color: #ffdb9a;
}

.game-box-header {
    font-weight: bold;
    font-size: 1.2rem;
    margin: 1rem 2rem;
}

#console {
    justify-self: start;
    height: fit-content;
}

#main-game-container {
    align-self: start;
    height: fit-content;
}

#main-game {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
}

#button-container {
    margin: 0;
}

#console p{
    font-size: 1.25rem;
}


/* ========================================
   anchored side tabs and content panel
   ======================================== */

#tabs-column-wrapper {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    position: relative;
    height: 100%;
    display: flex;
    align-items: flex-start;
    width: fit-content;
    justify-self: end;
    transform: translateX(2rem);
    transition: transform 0.5s ease;
}

#vertical-tabs-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding: 1rem 0.5rem;
    box-sizing: border-box;
}

#vertical-tabs-container .button-wrapper {
    margin: 0;
}

#vertical-tabs-container .vertical-tab-button {
    background-color: #db9b24;
    color: #ffdb9a;
    border: none;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    font-size: 1rem;
    border-radius: 7px;
    box-sizing: border-box;
    font-family: "Momo Trust Sans", sans-serif;
}

#vertical-tabs-container .vertical-tab-button:hover {
    background-color: #d49621;
}

#vertical-tabs-container .vertical-tab-button.active {
    background-color: #a0721c;
    color: #d49621;
    font-weight: bold;
}

#tab-content-area {
    position: absolute;
    top: 7rem;
    right: 1rem;
    left: calc(100% + 1rem);

    height: 100%;
    width: 20rem;
    background-color: #bd851d;
    z-index: 20;
    border-radius: 7px;

    transition: opacity 0.3s ease-out, visibility 0.3s ease-out, transform 0.5s ease;

    overflow-y: visible;
    overflow-x: visible;
    padding: 1rem;
    box-sizing: border-box;
}

.open {
    opacity: 1;
    visibility: visible;
}

#tabs-column-wrapper.open {
    transform: translateX(-18rem);
}

#tab-content-area.open {
    transform: translateX(-20rem);
}

#tab-content-area h3 {
    margin-left: 0;
    text-align: center;
    padding-top: 10px;
}

#tab-content-area p {
    color: #ffdb9a;
    margin: 1rem;
    font-size: 1.2rem;
    text-align: left;
}

/* ========================================
   hidden stuff (until unlocked by game logic)
   ======================================== */

#win-message {
    display: none;
}

#win-message {
    color: #db9b24;
    font-size: 2rem;
    text-align: center;
    margin-top: 2rem;
}

/* ========================================
   loading screen
   ======================================== */

#loading-screen {
    position: fixed;
    inset: 0;
    background-color: #ffdb9a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-bubbles {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.load-bubble {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    opacity: 0.9;
    animation: bubbleBounce 1.2s infinite ease-in-out;
    animation-delay: var(--delay);
}

@keyframes bubbleBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-20px) scale(1.1);
    }
}

#loading-text {
    color: #bd851d;
    font-size: 1.5rem;
    font-family: "Momo Trust Sans", sans-serif;
}

#tip-text {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    color: #a0721c;
    font-size: 1rem;
    font-family: "Momo Trust Sans", sans-serif;
    opacity: 0.8;
}

/* ========================================
   popup overlay (used for messages)
   ======================================== */

#boba-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #d495214b;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

#boba-popup {
    background-color: #a0721c;
    color: #fad693;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    max-width: 80%;
    font-family: "Momo Trust Sans", sans-serif;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#boba-popup p {
    color: #ffdb9a;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 100%;
}

#boba-popup-btn {
    margin: 1.5rem auto 0;
    padding: 0.8rem 2rem;
    border-radius: 0.5rem;
    border: none;
    background-color: #ffd079;
    color: #a0721c;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.15s ease;
    white-space: normal;
    word-wrap: break-word;
    max-width: 100%;
    display: block;
}

#boba-popup-btn:hover {
    transform: scale(1.05);
}

#boba-popup.show {
    animation: bobaPopIn 0.4s ease forwards;
}

@keyframes bobaPopIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    60% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

/* ========================================
   decorative floating bubbles (clickable easter eggs)
   ======================================== */

.boba-bubbles {
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 90;
    margin-bottom: 20px;
    height: 100px;
    position: fixed;
    pointer-events: none;
}

.bubble {
    background-image: url("boba-pearl.png");
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

.boba-bubbles .bubble {
    pointer-events: all;
    position: absolute;
    bottom: 0;
    left: var(--left);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    animation: floatUp 5s ease-in-out infinite;
    animation-delay: var(--delay);
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translateY(-20px) scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 0.5;
    }
}

@media (prefers-reduced-motion: reduce) {
    .boba-bubbles .bubble {
        animation: none;
    }
}
