/* There Will Be Clicks — modern take on the oil-baron theme.
   Dark warm surfaces, gold accents, the oil pad keeps the original
   sand color so the black drop stays readable. */

:root {
    --bg: #16130f;             /* warm near-black app background */
    --surface: #211c16;        /* cards */
    --surface-2: #2b251d;      /* raised elements inside cards */
    --border: #3a332a;
    --sand: #C2B280;           /* original desert tone, kept for the clicker pad */
    --gold: #d4af37;
    --red-gold: #e92a35;
    --text: #ece5d8;           /* warm off-white */
    --text-muted: #a89e8c;
    --font-display: Arial, Helvetica, sans-serif;
    --font-ui: Arial, Helvetica, sans-serif;
    --radius: 12px;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--bg);
    background-image: radial-gradient(ellipse at 50% -20%, rgba(212, 175, 55, 0.06), transparent 60%);
    color: var(--text);
    font-family: var(--font-ui);
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--gold);
    letter-spacing: 0.5px;
}

.unselectable {
    -webkit-user-select: none;
    user-select: none;
}

/* ---- Layout ---- */

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
    gap: clamp(16px, 3vw, 32px);
    max-width: 1320px;
    margin: 0 auto;
    padding: clamp(12px, 2vw, 24px) clamp(12px, 3vw, 32px) 56px;
    align-items: start;
}

@media (max-width: 920px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

.sectionLeft {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(16px, 2.5vw, 28px);
    position: sticky;
    top: 16px;
}

@media (max-width: 920px) {
    .sectionLeft {
        position: static;
    }
}

.sectionRight {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* ---- Cards ---- */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px 16px;
}

.panel h2 {
    margin: 0 0 10px;
    padding: 0 0 8px;
    font-size: 17px;
    border-bottom: 1px solid var(--border);
}

/* ---- News ticker ---- */

#ticker {
    display: flex;
    align-items: center;
    max-width: 1320px;
    margin: 12px auto 4px;
    padding-right: 4px;
    width: calc(100% - 2 * clamp(12px, 3vw, 32px));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

#ticker-title {
    flex: none;
    padding: 6px 18px;
    font-family: var(--font-display);
    color: var(--gold);
    border-right: 1px solid var(--border);
    background: var(--surface-2);
}

.ticker-viewport {
    flex: 1;
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, black 32px, black calc(100% - 32px), transparent);
}

.ticker-track {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    width: max-content;
    animation: ticker-scroll 70s linear infinite;
}

/* Track holds two copies of the headlines; sliding by -50% lands exactly
   on the start of the second copy, so the loop is seamless. */
@keyframes ticker-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

#ticker:hover .ticker-track {
    animation-play-state: paused;
}

.ticker-item {
    color: var(--text-muted);
    padding: 6px 0;
    font-size: 14px;
}

.ticker-logo {
    width: 20px;
    margin: 0 16px;
    filter: invert(0.75) sepia(0.4);
    opacity: 0.7;
}

/* ---- Stats ---- */

.scoreContainer {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 560px;
}

@media (max-width: 480px) {
    .scoreContainer {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 12px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    min-width: 0;
}

.stat-value {
    font-family: var(--font-display);
    font-size: clamp(18px, 2vw, 24px);
    font-weight: bold;
    color: var(--gold);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

/* ---- Clicker ---- */

#clicker {
    position: relative;
    background-image: url("./images/oil2.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 78%;
    background-color: var(--sand);
    transition: transform 0.15s ease-out, box-shadow 0.2s ease-out;
    height: min(380px, 78vw);
    width: min(380px, 78vw);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow), inset 0 0 60px rgba(0, 0, 0, 0.18);
    cursor: pointer;
}

#clicker:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 28px rgba(212, 175, 55, 0.25), inset 0 0 60px rgba(0, 0, 0, 0.18);
}

#clicker:active {
    transform: scale(0.97);
}

.click-number {
    position: absolute;
    z-index: 99;
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: bold;
    /* readable on both the sand pad and the black drop */
    color: #f5d76e;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0 10px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    animation: float-up 1.4s ease-out forwards;
}

@keyframes float-up {
    from { transform: translateY(0); opacity: 1; }
    to   { transform: translateY(-140px); opacity: 0; }
}

/* ---- Shop / sales rows ---- */

.shopButton {
    display: grid;
    grid-template-columns: 56px auto minmax(0, 1fr) auto;
    grid-template-areas:
        "icon name name   count"
        "icon cost income count";
    column-gap: 12px;
    align-items: center;
    width: 100%;
    margin: 8px 0;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-ui);
    text-align: left;
    color: var(--text);
    transition: border-color 0.25s ease, box-shadow 0.25s ease,
                background-color 0.15s ease, filter 0.25s ease, transform 0.1s ease;
}

.shopButton img {
    grid-area: icon;
    height: 48px;
    width: 48px;
    padding: 4px;
    border-radius: 10px;
    background: rgba(194, 178, 128, 0.85); /* sand tile keeps dark glyphs visible */
    filter: sepia(35%);
}

.shop-name-cost {
    display: contents; /* children place themselves in the grid areas */
}

.shop-name {
    grid-area: name;
    font-family: var(--font-display);
    font-size: 17px;
    line-height: 1.25;
    color: var(--text);
}

.shop-cost {
    grid-area: cost;
    font-size: 13px;
    color: var(--gold);
    white-space: nowrap;
}

.shop-income {
    grid-area: income;
    justify-self: end;
    align-self: center;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    padding-left: 10px;
}

.shop-count {
    grid-area: count;
    font-family: var(--font-display);
    font-size: 26px;
    min-width: 34px;
    text-align: center;
    color: var(--red-gold);
}

/* Affordable rows glow gently and lift on hover; unaffordable sit dimmed. */
.shopButton.affordable {
    cursor: pointer;
    border-color: rgba(212, 175, 55, 0.7);
    animation: afford-glow 2.4s ease-in-out infinite;
}

.shopButton.affordable:hover {
    background-color: #332c22;
    transform: translateY(-1px);
}

.shopButton.affordable:active {
    transform: translateY(0);
}

.shopButton:not(.affordable) {
    filter: saturate(0.4) brightness(0.7);
    cursor: default;
}

@keyframes afford-glow {
    0%, 100% { box-shadow: 0 0 4px rgba(212, 175, 55, 0.15); }
    50%      { box-shadow: 0 0 14px rgba(212, 175, 55, 0.4); }
}

/* Quick gold flash when a purchase lands. */
.shopButton.bought {
    animation: bought-flash 0.4s ease-out;
}

@keyframes bought-flash {
    0%   { background-color: rgba(212, 175, 55, 0.4); }
    100% { background-color: var(--surface-2); }
}

/* ---- Upgrades & awards ---- */

#upgradeContainer,
#awardContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#upgradeContainer img,
#awardContainer img {
    height: 52px;
    width: 52px;
    padding: 6px;
    background: rgba(194, 178, 128, 0.85);
    filter: sepia(35%);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: transform 0.15s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

#upgradeContainer img {
    cursor: pointer;
}

#upgradeContainer img:hover {
    transform: scale(1.08);
}

#upgradeContainer img.affordable {
    border-color: rgba(212, 175, 55, 0.7);
    animation: afford-glow 2.4s ease-in-out infinite;
}

/* ---- Footer ---- */

.sectionFooter {
    text-align: center;
    color: var(--text-muted);
}

.sectionFooter h5 {
    margin: 0 0 10px;
    font-size: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.sectionFooter p {
    margin: 2px 0;
    font-size: 13px;
}

#resetButton {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 20px;
    margin: 4px 0 10px;
    font-family: var(--font-ui);
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.2s ease;
}

#resetButton:hover {
    background: #3a2224;
    border-color: var(--red-gold);
    color: #ff8f96;
}
