/* ── History Page ─────────────────────────────────────────── */

.history-page {
    min-height: 100vh;
    background: var(--bg-deep, #050a1a);
    color: #e0e8ff;
    font-family: 'Noto Sans SC', 'Orbitron', sans-serif;
    max-width: 820px;
    margin: 0 auto;
    padding: 0 0 80px;
}

/* ── Header ── */
.history-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 20px 12px;
    border-bottom: 1px solid rgba(80,140,255,.15);
}
.history-back {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6ca0f0;
    text-decoration: none;
    font-size: 0.88rem;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(80,140,255,.2);
    transition: background .2s;
}
.history-back:hover { background: rgba(80,140,255,.12); }
.history-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: #c8d8ff;
    margin: 0;
}

/* ── Loading ── */
.history-loading-text {
    text-align: center;
    padding: 30px;
    color: #556;
    font-size: .9rem;
}

/* ── Round navigation (prev / info / next) ── */
.round-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(80,140,255,.12);
}
.round-nav-btn {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(80,140,255,.2);
    border-radius: 10px;
    color: #80a8ff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    flex-shrink: 0;
    transition: background .18s, border-color .18s;
}
.round-nav-btn:hover:not(:disabled) {
    background: rgba(80,140,255,.16);
    border-color: rgba(80,160,255,.45);
}
.round-nav-btn:disabled { opacity: .3; cursor: not-allowed; }
.round-nav-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
    min-width: 0;
}
.round-nav-num {
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    font-weight: 700;
    color: #c0d4ff;
}
.round-nav-date { font-size: .75rem; color: #778; }

/* ── Detail panel ── */
.history-detail-section {
    margin: 0;
}
.history-board { padding: 16px 16px 20px; margin: 0; }

.board-jackpot-row {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}
.board-jackpot-row .board-prize-col {
    flex: 1;
    padding: 16px;
    border: 1px solid rgba(80,140,255,0.2);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(20,30,60,0.8) 0%, rgba(10,15,35,0.9) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.board-jackpot-row .board-prize-label {
    font-family: 'Noto Sans SC', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
    text-transform: uppercase;
    color: #c8d8ff;
    text-shadow: none;
    z-index: 1;
}
.board-jackpot-desc {
    font-size: 0.75rem;
    color: #7090b0;
    margin-bottom: 14px;
    letter-spacing: 0.04em;
    text-align: center;
    z-index: 1;
}
.board-jackpot-row .board-grand-slot {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    z-index: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.board-jackpot-row .board-grand-slot::after {
    display: none;
}
.board-jackpot-amount {
    font-family: 'Orbitron', monospace;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    margin-top: 0;
}

/* Subtle glow effects */
.board-jp1::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, #ff4d6d, transparent);
    opacity: 0.7;
}
.board-jp1 .board-prize-label { 
    color: #ff4d6d; 
    text-shadow: 0 0 15px rgba(255,77,109,0.5); 
}
.board-jp1 .board-jackpot-amount {
    color: #ff4d6d;
    text-shadow: 0 0 15px rgba(255,77,109,0.5);
}

.board-jp2::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, #ffcc00, transparent);
    opacity: 0.7;
}
.board-jp2 .board-prize-label { 
    color: #ffcc00; 
    text-shadow: 0 0 15px rgba(255,204,0,0.5); 
}
.board-jp2 .board-jackpot-amount {
    color: #ffcc00;
    text-shadow: 0 0 15px rgba(255,204,0,0.5);
}

/* Summary bar */
.detail-summary-bar {
    display: flex;
    gap: 20px;
    padding: 10px 20px;
    font-size: .8rem;
    color: #889;
    border-bottom: 1px solid rgba(80,140,255,.1);
}
.detail-summary-bar b { color: #c0d4ff; font-weight: 700; }

/* Search bar */
.h-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(80,140,255,.1);
    background: rgba(255,255,255,.02);
}
.h-search-icon { color: #556; flex-shrink: 0; }
.h-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: 'Orbitron', monospace;
    font-size: .9rem;
    color: #c0d4ff;
    letter-spacing: .06em;
}
.h-search-input::placeholder { color: #445; letter-spacing: .02em; font-family: inherit; }
.h-search-clear {
    background: none;
    border: none;
    color: #556;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 2px;
    transition: color .15s;
}
.h-search-clear:hover { color: #aac; }

/* Grand prize branch label */
.h-grand-branch {
    font-size: .7rem;
    color: #7090b0;
    margin-top: 5px;
    text-align: center;
    letter-spacing: .02em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
}

/* Search highlight states */
.h-num-slot.h-match {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    transform: scale(1.1);
    z-index: 2;
}
.h-num-slot.h-no-match {
    opacity: .22;
}
.h-highlight {
    color: #4dfff3;
    text-shadow: 0 0 8px rgba(77,255,243,.8);
}

/* Slot clickable override */
.h-clickable { cursor: pointer; transition: filter .15s, transform .12s; }
.h-clickable:hover { filter: brightness(1.35); transform: scale(1.06); }

/* ── Modal ── */
.h-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,15,.72);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}
.h-modal {
    background: linear-gradient(160deg, #0d1830 0%, #060f20 100%);
    border: 1px solid rgba(80,160,255,.3);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    padding: 28px 24px 24px;
    position: relative;
    box-shadow: 0 8px 60px rgba(0,60,200,.4);
}
.h-modal-close {
    position: absolute;
    top: 14px; right: 14px;
    background: rgba(255,255,255,.07);
    border: none;
    border-radius: 8px;
    color: #aac;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    transition: background .2s;
}
.h-modal-close:hover { background: rgba(255,255,255,.15); color: #fff; }

.h-modal-prize-badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 10px;
    background: rgba(80,140,255,.2);
    color: #80b8ff;
    border: 1px solid rgba(80,140,255,.3);
}
.h-badge-first  { background: rgba(77,255,243,.14); color: #4dfff3; border-color: rgba(77,255,243,.28); }
.h-badge-second { background: rgba(200,200,255,.15); color: #c0c8ff; border-color: rgba(200,200,255,.25); }
.h-badge-third  { background: rgba(200,120,60,.18); color: #e0a060; border-color: rgba(200,120,60,.28); }
.h-badge-jp1    { background: rgba(255,50,100,.15); color: #ff4d6d; border-color: rgba(255,50,100,.28); }
.h-badge-jp2    { background: rgba(255,180,50,.15); color: #ffcc00; border-color: rgba(255,180,50,.28); }
.h-badge-special     { background: rgba(80,200,140,.15); color: #60e0a8; border-color: rgba(80,200,140,.25); }
.h-badge-consolation { background: rgba(80,140,255,.18); color: #80b8ff; border-color: rgba(80,140,255,.28); }

.h-modal-code {
    font-family: 'Orbitron', monospace;
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: .16em;
    color: #fff;
    text-shadow: 0 0 20px rgba(100,180,255,.6);
    margin-bottom: 20px;
}

.h-modal-rows { display: flex; flex-direction: column; gap: 10px; }
.h-modal-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid rgba(80,120,200,.1);
    gap: 12px;
}
.h-modal-row--full { flex-direction: column; gap: 4px; }
.h-modal-label { font-size: .75rem; color: #667; text-transform: uppercase; letter-spacing: .06em; flex-shrink: 0; }
.h-modal-value { font-size: .88rem; color: #c0d0f0; text-align: right; }
.h-modal-hash {
    font-family: monospace;
    font-size: .7rem;
    color: #5588dd;
    word-break: break-all;
    text-decoration: none;
}
.h-modal-hash:hover { color: #80b0ff; text-decoration: underline; }
.mono { font-family: 'Orbitron', monospace; }

/* ── Winners list in modal ── */
.h-verification-box {
    background: rgba(80,140,255,.05);
    border: 1px dashed rgba(80,140,255,.3);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
    text-align: center;
}
.h-verify-title {
    font-size: 0.75rem;
    color: #80b8ff;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.h-verify-block-link {
    font-family: 'Noto Sans SC', sans-serif;
    font-size: 0.7rem;
    text-transform: none;
    letter-spacing: normal;
}
.h-verify-hash {
    font-family: 'Orbitron', monospace;
    font-size: 0.75rem;
    color: #5588dd;
    word-break: break-all;
    line-height: 1.4;
    margin-bottom: 6px;
}
.h-verify-highlight {
    color: #4dfff3;
    font-weight: 900;
    font-size: 0.85rem;
    text-shadow: 0 0 8px rgba(77,255,243,0.6);
}
.h-verify-note {
    font-size: 0.65rem;
    color: #667;
}

.h-winners-label {
    font-size: .75rem;
    color: #667;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 10px;
}
.h-winners-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.h-winner-row {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(80,140,255,.1);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.h-winner-top { 
    display: flex; 
    align-items: center; 
}
.h-winner-phone {
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    color: #c0d0f0;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.h-winner-branch {
    font-size: 0.75rem;
    color: #7090b0;
    background: rgba(80,140,255,.1);
    padding: 2px 8px;
    border-radius: 12px;
    letter-spacing: 0.02em;
}

/* Badge on grid slot for multiple winners */
.board-num-slot, .board-grand-slot { position: relative; }
.h-slot-badge {
    position: absolute;
    top: -8px; right: -8px;
    background: #0a1128;
    color: #4dfff3;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    font-weight: 900;
    border: 1px solid rgba(77,255,243,0.5);
    border-radius: 12px;
    min-width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-sizing: border-box;
    box-shadow: 0 0 8px rgba(77,255,243,0.3), inset 0 0 4px rgba(77,255,243,0.3);
    z-index: 2;
}
.h-grand-badge {
    top: -10px; right: -10px;
    font-size: 0.75rem;
    min-width: 26px;
    height: 26px;
    color: #ffcc00;
    border: 1px solid rgba(255,204,0,0.6);
    box-shadow: 0 0 10px rgba(255,204,0,0.3), inset 0 0 6px rgba(255,204,0,0.3);
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .history-page { padding-bottom: 60px; }
    .history-board { padding: 12px 10px 16px; }

    /* Grand prize row: tighter to fit 3 cards */
    .board-grand-row { gap: 6px; }
    .board-prize-col { padding: 10px 4px 8px; gap: 3px; }
    .board-prize-label { font-size: 0.6rem; letter-spacing: .05em; }
    .board-grand-slot { font-size: 1.1rem; letter-spacing: .06em; padding: 6px 2px; }

    /* Number grids: 4 columns instead of 5 */
    .board-numbers-grid { grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 8px 6px; }
    .board-num-slot { font-size: 0.8rem; letter-spacing: .04em; padding: 8px 2px; }

    /* Modal */
    .h-modal-code { font-size: 1.9rem; }
    .h-modal { padding: 22px 16px 18px; }
}
