:root {
    --sun: #f59e0b;
    --ocean: #0ea5e9;
    --coral: #ef4444;
    --sky: #e0f2fe;
    --sand: #fef3c7;
    --surface: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --success: #10b981;
    --danger: #f43f5e;
    --accent: #f97316;
    --card-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #7dd3fc 0%, #bae6fd 35%, #fef3c7 70%, #fde68a 100%);
    color: var(--text);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ─── Ocean Waves ──────────────────────────────────────────────────── */

.ocean {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    pointer-events: none;
    z-index: 0;
}

.wave {
    position: absolute;
    bottom: 0;
    width: 200%;
    height: 100%;
    background-repeat: repeat-x;
    animation: waveMove 8s linear infinite;
}

.wave-1 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120'%3E%3Cpath d='M0,60 C200,110 400,10 600,60 C800,110 1000,10 1200,60 L1200,120 L0,120 Z' fill='rgba(14,165,233,0.2)'/%3E%3C/svg%3E");
    background-size: 1200px 120px;
    animation-duration: 8s;
}

.wave-2 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120'%3E%3Cpath d='M0,80 C250,20 400,100 600,80 C800,60 1000,100 1200,80 L1200,120 L0,120 Z' fill='rgba(56,189,248,0.14)'/%3E%3C/svg%3E");
    background-size: 1200px 120px;
    animation-duration: 11s;
    animation-direction: reverse;
    bottom: -10px;
}

.wave-3 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120'%3E%3Cpath d='M0,40 C150,90 350,0 600,50 C850,100 1050,20 1200,60 L1200,120 L0,120 Z' fill='rgba(125,211,252,0.1)'/%3E%3C/svg%3E");
    background-size: 1200px 120px;
    animation-duration: 14s;
    bottom: -20px;
}

@keyframes waveMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ─── App Shell ─────────────────────────────────────────────────────── */

#app {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    width: 100%;
    max-width: 800px;
    padding: 24px;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(0,0,0,0.04);
}

header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(14,165,233,0.15);
}

header h1 {
    color: var(--sun);
    font-size: 2em;
    margin: 0;
    text-shadow: 0 2px 8px rgba(245,158,11,0.2);
    letter-spacing: 1px;
}

.header-controls {
    position: absolute;
    right: 0;
    display: flex;
    gap: 8px;
}

.sound-btn {
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.08);
    color: var(--muted);
    padding: 6px 12px;
    font-size: 1.1em;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0;
}

.sound-btn:hover {
    background: rgba(0,0,0,0.08);
    color: var(--text);
}

.sound-btn.muted {
    opacity: 0.4;
    text-decoration: line-through;
}

/* ─── Buttons ────────────────────────────────────────────────────────── */

button {
    background: var(--sun);
    color: white;
    border: none;
    padding: 10px 24px;
    font-size: 1.05em;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    margin: 8px;
    box-shadow: 0 2px 8px rgba(245,158,11,0.25);
}

button:hover {
    background: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(249,115,22,0.35);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* ─── Inputs ─────────────────────────────────────────────────────────── */

input {
    padding: 10px 16px;
    font-size: 1.05em;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    margin: 8px;
    text-align: center;
    background: rgba(0,0,0,0.02);
    color: var(--text);
    transition: border-color 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--sun);
}

/* ─── Views ──────────────────────────────────────────────────────────── */

.view {
    display: none;
    animation: fadeSlideIn 0.35s ease-out;
}

.view.active { display: block; }

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Login ──────────────────────────────────────────────────────────── */

#login-view {
    text-align: center;
}

#login-view h2 {
    color: var(--sun);
    font-size: 1.6em;
    margin-bottom: 8px;
}

#login-view p {
    color: var(--muted);
    margin-bottom: 20px;
}

/* ─── Player List ────────────────────────────────────────────────────── */

.player-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.player-card {
    background: #f8fafc;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    padding: 14px 20px;
    min-width: 150px;
    text-align: center;
    transition: all 0.3s;
    animation: cardPop 0.3s ease-out;
}

@keyframes cardPop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.player-card.ready {
    border-color: var(--success);
    background: rgba(16,185,129,0.06);
}

.player-card.bankrupt {
    border-color: var(--danger);
    background: rgba(244,63,94,0.05);
}

.player-card .player-name {
    font-size: 1.05em;
    font-weight: bold;
}

.player-card .player-stock {
    font-size: 0.85em;
    color: var(--muted);
    margin-top: 4px;
}

/* ─── Bot Controls ───────────────────────────────────────────────────── */

.bot-controls {
    margin: 16px 0;
    text-align: center;
}

.btn-small {
    padding: 6px 16px;
    font-size: 0.85em;
    margin: 0 4px;
    background: rgba(0,0,0,0.04);
    color: var(--muted);
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: none;
}

.btn-small:hover {
    background: rgba(0,0,0,0.08);
    color: var(--text);
    box-shadow: none;
    transform: none;
}

/* ─── Auction Board ──────────────────────────────────────────────────── */

.auction-board {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: white;
    border-radius: 14px;
    padding: 24px;
    margin: 16px auto;
    width: 85%;
    box-shadow: 0 4px 16px rgba(2,132,199,0.2);
    text-align: center;
}

.auction-board h3 {
    margin: 0 0 8px 0;
    font-size: 1em;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.auction-board .amount {
    font-size: 2.2em;
    font-weight: bold;
    display: inline-block;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { text-shadow: 0 0 10px rgba(255,255,255,0.2); }
    50% { text-shadow: 0 0 24px rgba(255,255,255,0.5); }
}

.auction-board .auction-label {
    font-size: 0.85em;
    opacity: 0.7;
    margin-top: 4px;
}

/* ─── Bidding ────────────────────────────────────────────────────────── */

#bidding-area {
    margin: 16px 0;
    text-align: center;
}

#bidding-status {
    color: var(--muted);
    font-style: italic;
    margin: 8px 0;
    text-align: center;
}

#bid-input {
    width: 120px;
}

/* ─── Resolution ─────────────────────────────────────────────────────── */

#resolution-view h2 {
    color: var(--ocean);
    margin-bottom: 12px;
    text-align: center;
}

.resolution-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
}

.resolution-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 10px;
    background: #f8fafc;
    border-left: 4px solid rgba(0,0,0,0.08);
    transition: all 0.3s;
}

.resolution-row.winner {
    background: rgba(16,185,129,0.06);
    border-left-color: var(--success);
}

.resolution-row.bankrupt {
    background: rgba(244,63,94,0.05);
    border-left-color: var(--danger);
}

.resolution-row .res-player {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.resolution-row .res-details {
    text-align: right;
    font-size: 0.9em;
    color: var(--muted);
}

.resolution-row .res-details strong {
    color: var(--text);
    font-size: 1.1em;
}

/* ─── Game Over ──────────────────────────────────────────────────────── */

#gameover-view h2 {
    font-size: 2em;
    color: var(--sun);
    text-align: center;
    animation: celebrate 1s ease-in-out infinite alternate;
}

@keyframes celebrate {
    from { transform: scale(1); }
    to { transform: scale(1.05); text-shadow: 0 0 30px rgba(245,158,11,0.5); }
}

#winner-announcement {
    font-size: 1.3em;
    color: var(--ocean);
    margin: 12px 0;
    text-align: center;
}

#final-scores {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
}

/* ─── Bot Tag ──────────────────────────────────────────────────────────── */

.bot-tag {
    display: inline-block;
    background: rgba(0,0,0,0.06);
    color: var(--muted);
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
    font-weight: bold;
    letter-spacing: 0.5px;
}

/* ─── Footer ──────────────────────────────────────────────────────────── */

#player-status {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(0,0,0,0.06);
    font-weight: bold;
    color: var(--sun);
    font-size: 0.95em;
    text-align: center;
}

/* ─── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    #app { padding: 16px; }
    header h1 { font-size: 1.4em; }
    .auction-board .amount { font-size: 1.6em; }
    .player-card { min-width: 120px; padding: 10px 14px; }
    .resolution-row { flex-direction: column; text-align: center; gap: 4px; }
    .resolution-row .res-details { text-align: center; }
}
