/**
 * fai3fai4.com - Custom CSS
 *
 * Faithful port of the new.10elotto5minuti.com stylesheet, with the
 * blue/gold palette of the reference swapped for the green palette
 * frozen in docs/PLAN.md §7. Structure, selectors, layout rules and
 * geometry are intentionally kept identical to the reference so that
 * each page renders with the same look-and-feel — only the colours
 * change.
 *
 * Palette mapping (reference -> fai3fai4):
 *   darkblue / #009 / #08c        -> radial green background
 *   #99f / #ccf (links)           -> --green-light / --green-mid
 *   gold / #ffd700                -> --green-light (#a8d96f)
 *   #3cf (h1)                     -> --green-light
 *   #ccd (h2/h3)                  -> --text-secondary
 *   table tr default #333         -> #1a3309 (--green-darker)
 *   td.lightblue / .lightyellow   -> alternating green tones
 */

/* ============================================================
   Palette tokens
   ============================================================ */
:root
{
    --green-light:     #a8d96f;
    --green-primary:   #6cc033;
    --green-mid:       #4a9024;
    --green-dark:      #2d5a16;
    --green-darker:    #1a3309;
    --green-bg-center: #3a6e1a;
    --green-bg-outer:  #1a3309;
    --text-on-green:   #ffffff;
    --text-secondary:  #d9f0c2;
    --border-on-green: rgba(255, 255, 255, 0.18);
    --shade-dark:      rgba(0, 0, 0, 0.30);
    --shade-darker:    rgba(0, 0, 0, 0.50);
}

/* ============================================================
   Utility classes (replacing Tailwind, mirror of reference)
   ============================================================ */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
@media screen and (min-width: 60em) {
    .md\:w-1\/4 { width: 25%; }
    .md\:w-\[70\.83\%\] { width: 70.83%; }
    .md\:w-\[4\.17\%\] { width: 4.17%; }
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }

html, body
{
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #eee;
    background: var(--green-darker);
    /* Safari-safe: NO background-attachment fixed */
    background: radial-gradient(circle farthest-corner at center center, var(--green-bg-center) 0%, var(--green-bg-outer) 100%) repeat scroll 0 0 var(--green-darker);
    padding-bottom: 32px;
    overflow-x: hidden;
}

a { color: var(--green-light); text-decoration: none; }
a:hover { color: #d6ff9a; text-decoration: underline; }

/* ============================================================
   Layout
   ============================================================ */
#layout
{
    display: flex;
    flex-wrap: wrap;
    min-height: calc(100vh - 32px);
}

.sidebar
{
    background: var(--shade-dark);
    padding: 5px 10px;
    color: #ccc;
}

.central-frame
{
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.content
{
    padding: 0 10px;
}

/* ============================================================
   Header
   ============================================================ */
.header
{
    text-align: left;
    padding: 10px;
}
.header h1
{
    color: var(--green-light);
    font-size: 1.4em;
    margin: 8px 0;
    font-weight: bold;
    line-height: 1.3;
}
.header h2
{
    color: var(--text-secondary);
    font-size: 1.1em;
    margin: 5px 0;
    font-weight: normal;
    clear: left;
}
.header h3
{
    color: var(--text-secondary);
    font-size: 1em;
    margin: 5px 0;
    font-weight: normal;
    line-height: 1.6em;
}
.sidebar_desk
{
    display: block;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 1em;
}

/* ============================================================
   Top Menu Bar
   ============================================================ */
#top_menu
{
    background: var(--green-darker);
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-on-green);
}
#top_menu .menu
{
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 18px;
}
#top_menu .menu li { display: inline-block; }
#top_menu .menu li.but_down
{
    background: var(--green-mid);
    border-radius: 4px;
    padding: 2px;
}
#top_menu .menu li a img,
#top_menu .menu li a svg { vertical-align: middle; }

.menu-icon
{
    display: inline-block;
    vertical-align: middle;
    transition: stroke 0.2s, fill 0.2s, opacity 0.2s;
}

#audio_btn
{
    opacity: 0.5;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
}
#audio_btn.active { opacity: 1; }
#audio_btn.active .audio-wave { stroke: var(--green-light); }
#audio_btn.active polygon { fill: var(--green-light); }

#top_menu .menu .audio-li { margin-left: 20px; }

/* ============================================================
   Lottery Dropdown
   ============================================================ */
.lottery-dropdown-wrap { position: relative; }
.lottery-dropdown
{
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 35000;
    min-width: 240px;
    background: linear-gradient(180deg, var(--green-darker) 0%, var(--green-dark) 100%);
    border: 1px solid var(--border-on-green);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
    padding: 6px 0;
    margin-top: 4px;
}
.lottery-dropdown.open { display: block; }
.lottery-dropdown-item
{
    display: block;
    padding: 14px 18px;
    color: var(--text-secondary);
    font-size: 1.05rem;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s;
    line-height: 1.3;
}
.lottery-dropdown-item:hover
{
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-left-color: var(--green-light);
    text-decoration: none;
}
.lottery-dropdown-item.lottery-dropdown-active
{
    color: var(--green-light);
    font-weight: bold;
    border-left-color: var(--green-light);
    background: rgba(168, 217, 111, 0.12);
}

/* ============================================================
   Countdown
   ============================================================ */
.countdown_container { margin-left: auto !important; }
#countdown
{
    color: var(--green-light);
    font-weight: bold;
    font-size: 1.8em;
    font-family: monospace;
    text-align: right;
}

/* ============================================================
   Content area
   ============================================================ */
.page_desk
{
    padding: 5px;
    margin: 10px 1%;
    width: 98%;
    border-radius: 5px;
}
.page_desk h3
{
    color: #eee;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.5em;
    border: 0 !important;
}
.page_desk h3 a
{
    color: var(--green-light) !important;
    font-weight: bold;
}
.page_desk b
{
    color: var(--text-secondary);
    font-weight: bold;
    margin-top: 15px;
}

h3.right_lottery
{
    color: var(--green-light);
    font-weight: bold;
    font-size: 1.5em; /* Safari fallback before clamp() */
    font-size: clamp(1.2em, 2.5vw, 1.8em);
    margin: 5px 0;
}
h3.right_title
{
    color: #eee;
    font-weight: bold;
    font-size: 1.2em;
    margin: 10px 0;
}
h3.title
{
    font-weight: bold;
    font-size: 1em !important;
    text-transform: uppercase;
    margin-top: 0;
}

.gold { color: var(--green-light); }

/* ============================================================
   Right column boxes (voice_info, prize_box, see_also)
   ============================================================ */
.right_desk
{
    display: block;
    color: #ccc;
    font-size: 1rem;
    font-weight: normal;
    margin: 20px 0 0 0;
    padding: 0;
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
}
.see_also
{
    color: #eee;
    margin: 10px 0;
    padding: 4px 8px;
}
.see_also b
{
    color: var(--green-light);
    display: block;
    margin-bottom: 2px;
}
.see_also a
{
    color: var(--text-secondary);
    display: block;
    padding: 0 0 0 20px;
    margin-left: 8px;
    position: relative;
    line-height: 1.4;
}
.see_also a::before
{
    content: "\25B8";
    position: absolute;
    left: 2px;
    color: var(--green-light);
}

#voice_info
{
    color: var(--green-darker);
    font-size: 1rem;
    padding: 12px 14px;
    background: linear-gradient(135deg, #d6f0a8, #a8d96f);
    border-radius: 6px;
    margin: 10px 0;
    line-height: 1.5;
}
#voice_info b { color: var(--green-darker); }
#voice_info .insight-title
{
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--green-darker);
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.18);
}
#voice_info .insight-row
{
    padding: 3px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
#voice_info .insight-row:last-child { border-bottom: none; }

#prize_box
{
    color: #2d2300;
    font-size: 1rem;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f5e6a3, #f0d97a);
    border-radius: 4px;
    margin: 10px 0;
    line-height: 1.6;
}
#prize_box b { color: #5a3e00; }
#prize_box .prize-row
{
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.10);
}
#prize_box .prize-row:last-child { border-bottom: none; }
#prize_box .prize-label { color: #555; }
#prize_box .prize-value { font-weight: bold; color: #3a2800; }
h4.pos-section-title
{
    margin: 24px 0 4px;
    font-size: 1em;
    font-weight: bold;
    color: var(--green-light);
    border-bottom: 1px solid rgba(168, 217, 111, 0.3);
    padding-bottom: 4px;
}
.gambling-warning
{
    margin-top: 12px;
    padding: 10px 12px;
    border-left: 3px solid var(--green-mid);
    background: rgba(0,0,0,0.25);
    border-radius: 4px;
    font-size: 1em;
    line-height: 1.5;
    color: #d9f0c2;
}
.gambling-warning a { color: var(--green-light); }

/* ============================================================
   Side Navigation labels (mobile slide-in trigger)
   ============================================================ */
.label-menu-sx
{
    position: fixed;
    z-index: 32000;
    left: -3px;
    top: 50%;
    width: 50px;
    font-size: 1em;
    background-color: var(--green-light);
    opacity: 0.6;
    color: var(--green-darker);
    text-align: center;
    vertical-align: middle;
    padding: 1px 2px;
    border-radius: 2px;
    cursor: pointer;
    transform: rotate(-270deg);
    transform-origin: left bottom;
}

@media screen and (min-width: 60em)
{
    .sidebar { display: block !important; }
    #layout { flex-wrap: nowrap; }
}

/* ============================================================
   Sidenav - slide-in panel
   ============================================================ */
.sidenav
{
    height: 100%;
    width: 320px;
    position: fixed;
    z-index: 32001;
    top: 0;
    background: linear-gradient(180deg, var(--green-darker) 0%, var(--green-dark) 50%, var(--green-mid) 100%);
    overflow-x: hidden;
    overflow-y: auto;
    transition: 0.5s;
    padding-top: 20px;
    padding-bottom: 120px;
    box-shadow: 4px 0 8px rgba(0, 0, 0, 0.5);
}
.sidenav.sidenav-left { left: -320px; }
.sidenav .closebtn
{
    position: absolute;
    top: 0;
    right: 20px;
    font-size: 36px;
    color: #ccc;
    cursor: pointer;
    text-decoration: none;
    display: block;
    padding: 0;
}
.sidenav .closebtn:hover { color: #fff; }

.sidenav::-webkit-scrollbar { width: 6px; }
.sidenav::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
.sidenav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }
.sidenav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.35); }
.sidenav { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) rgba(0,0,0,0.2); }

.sidenav details:first-of-type { margin-top: 40px; }
.sidenav details { border-bottom: 1px solid rgba(255, 255, 255, 0.10); }
.sidenav summary
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    color: var(--green-light);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    list-style: none;
    transition: background 0.2s;
}
.sidenav summary::-webkit-details-marker { display: none; }
.sidenav summary::after
{
    content: "\25B8";
    font-size: 1em;
    color: #ccc;
    transition: transform 0.2s;
}
.sidenav details[open] > summary::after { transform: rotate(90deg); }
.sidenav summary:hover { background: rgba(255, 255, 255, 0.06); }

.sidenav details ul
{
    list-style-type: none;
    padding: 0 0 8px 0;
    margin: 0;
}
.sidenav details ul li { margin: 0; }
.sidenav details ul li a
{
    padding: 5px 15px 5px 25px;
    text-decoration: none;
    font-size: 1em;
    color: var(--text-secondary);
    display: block;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}
.sidenav details ul li a:hover
{
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border-left-color: var(--green-light);
    text-decoration: none;
}
.sidenav .lottery-active
{
    color: var(--green-light) !important;
    border-left-color: var(--green-light) !important;
}
.sidenav .menu-active
{
    color: #fff !important;
    background: rgba(168, 217, 111, 0.18);
    border-left-color: var(--green-light) !important;
    font-weight: bold;
}
.sidenav .sub-link
{
    padding-left: 28px;
    font-size: 1em;
    color: rgba(217, 240, 194, 0.7);
}

#background-menu
{
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    position: fixed;
    z-index: 32000;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   Tables (default)
   ============================================================ */
table
{
    border-collapse: collapse;
    width: 100%;
    color: #eee;
}
table th
{
    background: var(--green-darker);
    color: #fff;
    padding: 6px 8px;
    text-align: left;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}
table tr
{
    background: var(--green-darker);
    color: white;
    border: 1px solid var(--border-on-green);
}
table tr.no-border
{
    background: var(--green-darker);
    color: white;
    border: 0;
}
table td
{
    padding: 4px;
    text-align: center;
    margin: 0.1em;
    border: 1px solid rgba(255, 255, 255, 0.20);
}

svg { max-width: 100%; height: auto; }

/* ============================================================
   Hidden utilities
   ============================================================ */
.hidden-xs { display: block; }
@media screen and (max-width: 35.5em) { .hidden-xs { display: none; } }

/* ============================================================
   Responsive
   ============================================================ */
@media (min-width: 60em)
{
    table, .extra-row { font-size: 1.5em; }
    table.responsive { font-size: 1em !important; }
}
@media (max-width: 60em)
{
    .central-frame
    {
        width: 100% !important;
        float: none;
    }
    table, .extra-row { font-size: 1em; }
    table.responsive { font-size: 1.1em !important; width: auto !important; overflow: auto; }
}

/* ============================================================
   Table colour classes (draws-list, alternating cells)
   Mapping: lightblue/lightyellow of the reference become two
   slightly different green-light tones, gold (leader) becomes
   the brightest green-light.
   ============================================================ */
td.lightblue   { background: #4a9024; color: #fff; border: 1px solid rgba(255,255,255,0.18); }
td.lightyellow { background: #6cc033; color: #fff; border: 1px solid rgba(255,255,255,0.18); }
td.gold        { background: #a8d96f; color: var(--green-darker); border: 1px solid rgba(255,255,255,0.18); }
td.first-col   { font-weight: bold; min-width: 30px; text-align: center; }
td.pos-header  { text-align: center; font-size: 1em; color: #a8d96f; font-weight: bold; padding: 2px 4px 0; }
td.text-bold   { font-weight: bold; }
td.text-right, .text-right { text-align: right; }
td.text-left,  .text-left  { text-align: left; }
td.text-center,.text-center{ text-align: center; }

/* ============================================================
   Analytical board (tabellone analitico)
   ============================================================ */
.board-table-wrapper { width: 100%; overflow-x: auto; margin-top: 12px; }
table.board-table
{
    width: 100%;
    border-collapse: collapse;
    font-size: 1em;
    background: var(--shade-darker);
    border: 1px solid var(--border-on-green);
    border-radius: 6px;
    overflow: hidden;
}
table.board-table thead th
{
    padding: 8px 6px;
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 1em;
    background: var(--green-darker);
    color: var(--green-light);
    border-bottom: 1px solid var(--border-on-green);
    position: static;
    top: auto;
}
table.board-table thead th.hdr-cd { background: var(--green-dark); color: #fff; }
table.board-table thead th.hdr-rl { background: var(--green-mid); color: #fff; }
table.board-table tbody tr:nth-child(odd) td.cell-cd,
table.board-table tbody tr:nth-child(odd) td.cell-rl
{
    background: var(--green-dark);
    color: #fff;
}
table.board-table tbody tr:nth-child(even) td.cell-cd,
table.board-table tbody tr:nth-child(even) td.cell-rl
{
    background: var(--green-mid);
    color: #fff;
}
table.board-table tbody tr.row-drawn td.cell-cd,
table.board-table tbody tr.row-drawn td.cell-rl
{
    background: var(--green-light);
    color: var(--green-darker);
}
table.board-table td
{
    padding: 6px 4px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.10);
    vertical-align: middle;
}
table.board-table td.cell-cd,
table.board-table td.cell-rl
{
    font-weight: bold;
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
    min-width: 36px;
}
table.board-table td.cell-pos
{
    background: rgba(0, 0, 0, 0.30);
    padding: 4px;
}
table.board-table tbody tr:hover td.cell-pos { background: rgba(168, 217, 111, 0.10); }

.bnum
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--green-light) 0%, var(--green-primary) 60%, var(--green-dark) 100%);
    color: #1a3309;
    font-weight: bold;
    font-size: 1em;
    text-shadow: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}
.bnum-empty
{
    background: transparent;
    box-shadow: none;
    border: 1px dashed rgba(255, 255, 255, 0.18);
}
.bnum-lg
{
    width: 52px;
    height: 52px;
    font-size: 1.6em;
}
.bnum-drawn
{
    background: radial-gradient(circle at 35% 30%, #ffffff 0%, var(--green-light) 50%, var(--green-mid) 100%);
    color: var(--green-darker);
    text-shadow: none;
    box-shadow: 0 0 8px rgba(168, 217, 111, 0.65);
}
.board-legend
{
    margin-top: 10px;
    padding: 8px 12px;
    font-size: 1em;
    color: var(--text-secondary);
    border-left: 3px solid var(--green-primary);
    background: var(--shade-darker);
    border-radius: 3px;
}
.board-legend strong { color: var(--green-light); }

/* ============================================================
   Prize table
   ============================================================ */
.prize-section { margin-bottom: 20px; }
.prize-section-title
{
    font-size: 1.15rem;
    font-weight: 700;
    padding: 10px 14px;
    margin: 0;
    background: var(--green-dark);
    color: #fff;
    border-radius: 8px 8px 0 0;
    letter-spacing: 0.3px;
}
table.prize-table
{
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 6px 0;
    font-size: 1em;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
table.prize-table thead th
{
    background: var(--green-mid);
    color: #fff;
    font-weight: 600;
    padding: 10px 14px;
    text-transform: capitalize;
    font-size: 1em;
    border-bottom: 2px solid var(--green-darker);
    position: static;
    top: auto;
    text-align: left;
}
table.prize-table tbody td
{
    padding: 9px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    color: #f4f9eb;
    font-size: 1em;
    background: var(--shade-darker);
    text-align: left;
}
table.prize-table tbody tr:last-child td { border-bottom: none; }
table.prize-table tbody tr:nth-child(odd)  td { background: rgba(0, 0, 0, 0.40); }
table.prize-table tbody tr:nth-child(even) td { background: rgba(0, 0, 0, 0.55); }
td.prize-factor
{
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--green-light);
    text-align: right;
}

/* ============================================================
   Header elements
   ============================================================ */
.game-name
{
    color: var(--green-light);
    font-weight: bold;
}
.last-date-info
{
    color: var(--text-secondary);
    font-size: 1.3rem;
    margin: 2px 0 10px 0;
}
.fullscreen-source
{
    position: absolute;
    z-index: 1;
    color: var(--text-secondary);
    font-weight: bold;
    margin-bottom: 4px;
    float: right;
    padding-top: 5px;
    padding-left: 350px;
}

/* ============================================================
   Forecast layout
   ============================================================ */
.forecast-block
{
    overflow: hidden;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--shade-dark);
    border-radius: 8px;
    border: 1px solid var(--border-on-green);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
}
.forecast-block h3.title { width: 100%; margin: 0 0 8px 0; color: var(--green-light); }
.forecast-left { flex: 1; min-width: 200px; }
.forecast-left svg { max-height: 240px; width: auto; }
.forecast-right
{
    width: 180px;
    flex-shrink: 0;
    text-align: center;
}
.forecast-label
{
    color: var(--text-secondary);
    font-size: 1em;
    font-weight: bold;
    text-transform: uppercase;
    margin-top: 5px;
    line-height: 1.3;
}
.forecast-desc
{
    color: var(--green-light);
    font-size: 1.4rem;
    line-height: 1.3;
    margin-bottom: 10px;
}
.forecast-meta
{
    color: var(--text-secondary);
    font-size: 1em;
    margin-bottom: 10px;
}
@media (max-width: 35.5em) { .forecast-right { width: 140px; } }

/* ============================================================
   Draws list
   ============================================================ */
.extra-row
{
    display: flex;
    flex-wrap: wrap;
    margin-top: -1px;
}
.extra-header
{
    width: 100%;
    background: var(--green-dark);
    color: white;
    text-align: center;
    font-weight: bold;
    padding: 2px;
}
.extra-num
{
    background: var(--green-light);
    color: var(--green-darker);
    border: 1px solid rgba(255,255,255,0.18);
    padding: 3px 4px;
    text-align: center;
    flex: 1;
}

/* ============================================================
   Footer
   ============================================================ */
#organization
{
    letter-spacing: 0.06em;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    background: var(--green-darker);
    color: var(--text-secondary);
    position: fixed;
    z-index: 1501;
    text-align: right !important;
    vertical-align: top;
    bottom: 0;
    min-height: 30px;
    font-size: 1em;
    margin: 0;
    padding: 2px 10px 0 10px;
    border-top: 1px solid var(--green-light);
}
#organization a { color: var(--green-light); }
#organization .powered-by { font-weight: bold; }

/* ============================================================
   Placeholder text used by stub controllers
   ============================================================ */
.placeholder
{
    opacity: 0.75;
    font-style: italic;
    color: var(--text-secondary);
}
