:root {
    --bg-dark: #0b0b0b;
    --bg-panel: #141414;
    --bg-glass: rgba(20, 20, 20, 0.85);
    --border-glass: rgba(255, 255, 255, 0.1);
    --accent: #d2b48c;
    --accent-glow: rgba(210, 180, 140, 0.4);
    --primary-btn: #d4a35a;
    --text-main: #e0e0e0;
    --text-muted: #8a8a8a;
    --mana-w: #fffbd5;
    --mana-u: #aae0fa;
    --mana-b: #cbc2bf;
    --mana-r: #f9aa8f;
    --mana-g: #9bd3ae;
    --mana-c: #ccc2c0;
    --mana-m: #eecf73;
    --mana-l: #8f6a4e;
    --card-radius: 4.5% / 3.5%;
    --card-width-draft: 190px;
    --card-width-deck: 160px;
    --card-width-mini: 100px;
    --z-base: 1;
    --z-ui: 100;
    --z-hover: 500;
    --z-overlay: 1000;
}
* { 
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Roboto', sans-serif;
    height: 100vh;
    overflow: hidden;
    background-image: radial-gradient(circle at 50% 50%, #1a1a1a 0%, #000000 100%);
}
h1, h2, h3 {
    font-family: 'Cinzel',
    serif; font-weight: 700;
}
button {
    font-family: 'Cinzel', serif;
    letter-spacing: 1px;
}

/* scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #111;
}
::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* animation */
.hidden {
    opacity: 0;
    pointer-events:
    none;
    z-index: -1;
    position: absolute;
}
.active-view {
    opacity: 1;
    z-index: var(--z-base);
    position: relative;
    width: 100%;
    height: 100%;
}

/* buttons */
.btn {
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    padding: 10px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-size: 0.9rem;
    border-radius: 2px;
}
.btn:hover {
    background: var(--accent);
    color: #000;
    box-shadow: 0 0 15px var(--accent-glow);
}
.btn-primary {
    background: var(--primary-btn);
    color: #111;
    font-weight: bold;
    border: none;
}
.btn-sm {
    padding: 2px 8px;
    font-size: 0.8rem;
    min-width: 24px;
    border: 1px solid #444;
    color: #aaa;
}
.btn-sm:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}
.btn-sm.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* selection */
select {
    background: rgba(0,0,0,0.5);
    border: 1px solid #444;
    color: white;
    padding: 10px;
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    outline: none;
    border-radius: 4px;
}
select:focus {
    border-color: var(--accent);
}

/* card */
.card {
    position: relative;
    border-radius: var(--card-radius);
    background-color: #111;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
    transform-style: preserve-3d;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none; 
}
.card img {
    width: 100%;
    display: block;
    border-radius: var(--card-radius);
    pointer-events: none; /* let clicks pass to card div */
    backface-visibility: hidden;
}
.card-lg { width: var(--card-width-draft); }
.card-md { width: var(--card-width-deck); }
.card-sm { width: var(--card-width-mini); }
.card-lg:hover {
    transform: translateY(-20px) scale(1.05);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    z-index: var(--z-hover);
    outline: 2px solid var(--accent);
}
.card-md {
    margin-bottom: -180px;
}
.card-md:hover {
    transform: translateY(-30px);
    z-index: var(--z-hover);
}
.card.rarity-mythic {
    box-shadow: 0 0 15px rgba(255, 80, 0, 0.4);
}
.card.rarity-rare {
    box-shadow: 0 0 15px rgba(210, 180, 140, 0.4);
}
.card.foil::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.2) 50%, transparent 60%);
    background-size: 300% 300%;
    border-radius: var(--card-radius);
    pointer-events: none;
    animation: foilShine 4s ease-in-out infinite;
    z-index: 2;
}

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

/* hero section */
#view-hero {
    display: flex;
    justify-content: center;
    align-items: center;
    background: url('https://cards.scryfall.io/art_crop/front/7/9/79905f74-0597-4d5e-8d8a-5444d37000e1.jpg?1674322839') no-repeat center center/cover;
}
#view-hero::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.4), #000);
}
.hero-overlay {
    position: relative; z-index: 2;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    padding: 4rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}
.hero-overlay h1 {
    font-size: 4rem;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(210,180,140,0.5);
    margin-bottom: 0.5rem;
}
.hero-overlay p {
    font-size: 1.2rem;
    letter-spacing: 4px;
    color: #fff;
    text-transform: uppercase;
    margin-bottom: 3rem;
}
.setup-controls {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
    justify-content: center;
}
.set-picker {
    display: flex;
    gap: 1rem;
    align-items: center;
}
#btn-start-draft {
    min-width: 250px;
    padding: 15px 40px;
}

/* draft table section */
#view-draft {
    display: flex; flex-direction: column;
    height: 100vh;
    padding-top: 20px;
    -webkit-user-select: none; /* prevent highlight */
    -ms-user-select: none;
    user-select: none;
}
#opponents-area {
    display: flex; justify-content: center; gap: 40px;
    padding: 10px 0;
    height: 120px;
}
.opponent {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.5;
    transition: opacity 0.3s;
}
.opponent:hover {
    opacity: 1;
}
.opponent .avatar {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: #222;
    border: 2px solid #555;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.5rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    margin-bottom: 5px;
}
.opponent .name {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: bold;
}
.opponent .pack-count { 
    font-size: 0.7rem;
    background: #333;
    padding: 2px 6px; 
    border-radius: 10px;
    margin-top: 4px; 
}
#active-pack-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}
#pack-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 1600px;
}
#player-area {
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid var(--border-glass);
    height: 180px;
    display: flex; align-items: flex-end;
    padding: 0 40px 10px 40px;
}
.player-info {
    margin-bottom: 20px;
    margin-right: 40px;
    min-width: 150px;
}
.player-info h3 {
    color: var(--accent);
    font-size: 1.2rem;
    margin-bottom: 5px;
}
#player-hud-columns {
    flex: 1;
    display: flex;
    gap: 15px;
    height: 100%;
    align-items: flex-end;
}
.mana-column {
    display: flex;
    flex-direction: column-reverse;
    width: 40px;
    position: relative;
    padding-bottom: 25px;
}
.col-label {
    position: absolute;
    bottom: 0;
    width: 100%;
    text-align: center;
    font-family: 'Cinzel';
    color: #666;
}
.pool-card {
    height: 6px;
    width: 100%;
    border-bottom: 1px solid rgba(0,0,0,0.5);
    cursor: help;
}
.pool-card:hover {
    transform: scaleX(1.5);
    z-index: 100;
    border: 1px solid white;
}
.pool-card .tooltip-image {
    display: none;
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 240px;
    border-radius: var(--card-radius);
    border: 2px solid #000;
    box-shadow: 0 0 20px rgba(0,0,0,1);
    z-index: var(--z-overlay);
}
.pool-card:hover .tooltip-image { display: block; }
.bg-w { background: var(--mana-w); }
.bg-u { background: var(--mana-u); }
.bg-b { background: var(--mana-b); }
.bg-r { background: var(--mana-r); }
.bg-g { background: var(--mana-g); }
.bg-m { background: var(--mana-m); }
.bg-c { background: var(--mana-c); }
.bg-l { background: var(--mana-l); }

/* draft table section */
#view-builder {
    background: #111;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
#builder-header {
    height: 90px;
    background: #000;
    border-bottom: 1px solid #333;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 30px;
}
.deck-stats {
    text-align: left;
}
.deck-stats h2 {
    color: var(--accent);
    font-size: 1.5rem;
    margin-bottom: 5px;
}

/* Land Station Control Panel */
.land-station {
    display: flex;
    gap: 10px;
    background: #1a1a1a;
    padding: 10px 20px;
    border-radius: 50px;
    border: 1px solid #333;
}
.land-control {
    display: flex;
    align-items: center;
    gap: 8px;
}
.mana-symbol {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
}
.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}
#main-deck-area {
    flex: 1;
    display: flex;
    padding: 20px 40px;
    gap: 15px;
    overflow-x: auto;
    overflow-y: auto;
    align-items: flex-start;
    justify-content: center;
    background: radial-gradient(circle at center, #1e1e1e 0%, #000 100%);
    min-height: 0; 
}
.deck-column {
    min-width: var(--card-width-deck);
    min-height: 450px;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-top: 40px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}
.deck-column::before {
    content: attr(data-cmc);
    position: absolute; top: 0; left: 0; width: 100%;
    text-align: center; color: #444; font-family: 'Cinzel'; font-size: 1.5rem;
    border-bottom: 1px solid #333; padding-bottom: 5px;
}
.builder-divider {
    background: #000; border-top: 1px solid #333; border-bottom: 1px solid #333;
    padding: 10px 30px;
    color: var(--accent); text-transform: uppercase; letter-spacing: 2px;
    font-size: 0.8rem;
}
#sideboard-area {
    height: 280px;
    flex-shrink: 0;
    background: #0e0e0e;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow-y: auto;
}

/* overlay */
#notification-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: var(--z-overlay);
    backdrop-filter: blur(5px);
}
#notification-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.notification-content h2 {
    font-size: 5rem;
    color: transparent;
    -webkit-text-stroke: 2px var(--accent);
    text-transform: uppercase;
    letter-spacing: 10px;
}