/* ============================================================
   Unlucky Sevens — Stylesheet
   ============================================================ */

/* Base */
body {
    font-family: sans-serif;
    text-align: center;
    background: #f0f0f0;
    margin: 0;
    padding: 10px;
    min-height: 100vh;
    box-sizing: border-box;
}

.hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
}

/* Banner */
.banner {
    width: 100%;
    height: auto;
    max-height: 160px;
    object-fit: contain;
    display: block;
    margin: 0 auto 10px auto;
    border-radius: 4px;
}

/* ============================================================
   Player Grid
   ============================================================ */
.player-board {
    border: 1px solid #ccc;
    margin: 10px;
    padding: 10px;
    border-radius: 5px;
}

.grid-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    margin: 6px 0;
}

.number-box {
    width: 48px;
    height: 48px;
    line-height: 48px;
    border: 2px solid #333;
    border-radius: 4px;
    font-weight: bold;
    font-size: 15px;
    background: #eee;
    text-align: center;
    flex-shrink: 0;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.covered {
    background: #4CAF50;
    color: white;
    border-color: #2E7D32;
}

.active-turn {
    background-color: #e3f2fd;
    border: 2px solid #2196F3;
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.4);
    transform: scale(1.02);
}

.covered.recently-uncovered { border: 2px solid #d32f2f; }

.recently-uncovered {
    border: 2px solid #d32f2f;
    position: relative;
    animation: flash-red 2s ease-out;
}

.recently-uncovered::after {
    content: "\274C";
    position: absolute;
    top: -15px;
    right: -15px;
    font-size: 20px;
    filter: drop-shadow(0 0 2px white);
    z-index: 10;
}

@keyframes flash-red {
    0%   { background-color: #ffcdd2; transform: scale(1.1); }
    50%  { background-color: #ef9a9a; transform: scale(1.1); }
    100% { background-color: #eee;    transform: scale(1); }
}

.selectable-penalty {
    cursor: pointer;
    border: 2px dashed #d32f2f;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%   { opacity: 1; }
    50%  { opacity: 0.7; }
    100% { opacity: 1; }
}

/* ============================================================
   Buttons
   ============================================================ */
button {
    padding: 10px 20px;
    font-size: 15px;
    cursor: pointer;
    margin: 4px;
    border-radius: 4px;
}

.btn-green { background: #4CAF50; color: white; border: none; }
.btn-blue  { background: #2196F3; color: white; border: none; }
.btn-grey  { background: #607D8B; color: white; border: none; border-radius: 4px; padding: 10px 20px; font-size: 14px; }

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
    margin-left: 8px;
    background: #ddd;
    border: none;
    border-radius: 4px;
    color: #333;
}

input {
    padding: 10px;
    font-size: 16px;
    box-sizing: border-box;
}

/* ============================================================
   Dice
   ============================================================ */
.dice-container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 20px;
    margin: 16px auto;
    padding: 10px;
    transition: opacity 0.3s;
}

.dice-container.clickable { cursor: pointer; }
.dice-container.clickable:hover .die {
    border-color: #2196F3;
    box-shadow: 0 0 10px #2196F3;
}

.die {
    width: 64px;
    height: 64px;
    background: white;
    border: 2px solid #333;
    border-radius: 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 6px;
    box-shadow: 4px 4px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.dot {
    background: #333;
    border-radius: 50%;
    width: 10px;
    height: 10px;
    align-self: center;
    justify-self: center;
}

@keyframes shake {
    0%   { transform: rotate(0deg)   translate(0, 0); }
    25%  { transform: rotate(10deg)  translate(5px, 5px); }
    50%  { transform: rotate(-10deg) translate(-5px, -5px); }
    75%  { transform: rotate(10deg)  translate(-5px, 5px); }
    100% { transform: rotate(0deg)   translate(0, 0); }
}
.rolling .die { animation: shake 0.2s infinite; }

@keyframes pulse-dice {
    0%   { transform: scale(1);    filter: drop-shadow(0 0 0 rgba(33,150,243,0)); }
    50%  { transform: scale(1.05); filter: drop-shadow(0 0 10px rgba(33,150,243,0.8)); }
    100% { transform: scale(1);    filter: drop-shadow(0 0 0 rgba(33,150,243,0)); }
}
.dice-container.your-turn { animation: pulse-dice 1.5s infinite; cursor: pointer; }

/* ============================================================
   Game UI
   ============================================================ */
.message-box {
    color: #d32f2f;
    margin: 10px;
    min-height: 20px;
}

.sticky-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
    padding-top: 10px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
}

.dice-wrapper         { position: relative; }
#dice-instruction     { font-weight: bold; margin-bottom: 10px; }
.instruction-roll     { color: #2196F3; }
.instruction-penalty  { color: #d32f2f; }
#player-list          { font-size: 1.1em; margin: 5px 0; color: #333; }
.text-blue            { color: #1565C0; }
.turn-icon            { font-size: 1.2em; }
.log-entry            { margin-bottom: 4px; border-bottom: 1px solid #eee; }
#room-code-input      { width: 100px; text-transform: uppercase; }

/* ============================================================
   Hamburger Menu
   ============================================================ */
.hamburger-menu {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 200;
}

.hamburger-icon {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    margin: 0;
    width: auto;
    line-height: 1;
}

.menu-dropdown {
    position: absolute;
    right: 0;
    top: 40px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    width: 150px;
    display: flex;
    flex-direction: column;
    z-index: 300;
}

.menu-dropdown.hidden { display: none !important; }

.menu-dropdown button {
    margin: 0;
    padding: 10px 14px;
    border-radius: 0;
    background: white;
    color: #333;
    text-align: left;
    border: none;
    border-bottom: 1px solid #eee;
    width: 100%;
    font-size: 14px;
}

.menu-dropdown button:hover { background: #f0f0f0; }

/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.modal-overlay.hidden { display: none !important; }

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 380px;
    text-align: left;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-content-large { max-width: 520px; }
.log-modal-content   { max-width: 520px; max-height: 70vh; display: flex; flex-direction: column; }
.modal-header        { margin-top: 0; }
.modal-footer        { text-align: right; margin-top: 20px; }
.modal-footer-small  { text-align: right; margin-top: 10px; }

.setting-row { margin: 15px 0; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.setting-row input { width: 20px; height: 20px; margin: 0; padding: 0; }
.setting-row input:disabled + label { color: #999; }

.optional-rules-lobby {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 20px;
    justify-content: center;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px 16px;
    margin: 6px 4px;
    font-size: 14px;
}

.optional-rules-lobby-title {
    font-weight: bold;
    color: #777;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    width: 100%;
    text-align: center;
    margin-bottom: 2px;
}

.optional-rules-lobby label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #333;
}

.optional-rules-lobby input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

.optional-rules-lobby input[type="checkbox"]:disabled,
.optional-rules-lobby input[type="checkbox"]:disabled + * { cursor: default; color: #aaa; }

.rule-desc {
    display: block;
    font-size: 11px;
    color: #888;
    font-weight: normal;
    margin-top: 1px;
}

.setting-section-label {
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888;
    border-top: 1px solid #eee;
    padding-top: 12px;
    margin-top: 8px;
}

.rules-text    { text-align: left; font-size: 15px; line-height: 1.5; }
.rules-list    { padding-left: 20px; }
.rules-sublist { padding-left: 20px; margin: 5px 0; }

.log-content {
    flex: 1;
    overflow-y: auto;
    text-align: left;
    font-size: 13px;
    background: #f9f9f9;
    padding: 10px;
    border: 1px solid #eee;
    font-family: monospace;
}

/* ============================================================
   Overlays (Turn / Oh No / Doubles / Got It / Roll Em)
   ============================================================ */
.turn-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); z-index: 2000;
    display: flex; justify-content: center; align-items: center;
    pointer-events: none;
}

.turn-text {
    font-size: 2.5em;
    color: white; font-weight: bold;
    text-shadow: 0 0 10px #000;
    background: #2196F3;
    padding: 20px 40px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    pointer-events: none;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn { from { transform: scale(0); } to { transform: scale(1); } }

.oh-no-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2500; display: flex; justify-content: center; align-items: center;
    pointer-events: none;
}

.oh-no-text {
    font-size: clamp(60px, 12vw, 140px);
    color: #d32f2f; font-weight: 900;
    text-shadow: 4px 4px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff, 2px 2px 0 #fff;
    animation: zoomBig 2s ease-out forwards;
    text-align: center;
}

.got-it-text {
    font-size: clamp(40px, 8vw, 100px);
    color: #FF9800; font-weight: 900;
    text-shadow: 4px 4px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff, 2px 2px 0 #fff;
    animation: zoomBig 2s ease-out forwards;
    text-align: center; line-height: 1.1;
}

.doubles-text { color: #4CAF50; font-size: clamp(40px, 8vw, 100px); }

@keyframes zoomBig {
    0%   { transform: scale(0);   opacity: 0; }
    20%  { transform: scale(1);   opacity: 1; }
    80%  { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(3);   opacity: 0; }
}

.roll-em-text {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(1.5em, 4vw, 3.5em);
    color: #d32f2f; font-weight: 900;
    text-shadow: 3px 3px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
    pointer-events: none; z-index: 50; white-space: nowrap;
    animation: popFade 1.5s ease-out forwards;
}

@keyframes popFade {
    0%   { transform: translate(-50%,-50%) scale(0.5); opacity: 0; }
    20%  { transform: translate(-50%,-50%) scale(1.2); opacity: 1; }
    80%  { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(1.5); opacity: 0; }
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333; color: #fff;
    text-align: center; border-radius: 4px; padding: 16px;
    position: fixed; z-index: 4000;
    left: 50%; bottom: 30px; transform: translateX(-50%);
    font-size: 16px; opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
}
.toast.show { visibility: visible; opacity: 1; bottom: 50px; }

/* ============================================================
   Chat
   ============================================================ */
.chat-section { margin-top: 20px; border-top: 1px solid #ccc; padding-top: 10px; }

.chat-messages {
    height: 150px; overflow-y: auto;
    border: 1px solid #ccc; padding: 5px;
    text-align: left; background: #fff;
    margin-bottom: 5px; border-radius: 4px;
}

.chat-input-area { display: flex; gap: 5px; }
.chat-msg  { margin: 4px 0; font-size: 14px; }
.chat-name { font-weight: bold; color: #2196F3; margin-right: 5px; }

.btn-mic {
    background: #ff9800; color: white; border: none;
    border-radius: 50%; width: 40px; height: 40px;
    font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0; flex-shrink: 0;
}
.btn-mic.listening { background: #f44336; animation: pulse 1s infinite; }

/* ============================================================
   Mobile (max 600px) — only target login inputs/buttons
   ============================================================ */
@media (max-width: 600px) {
    .container { padding: 12px; }

    #login-section input,
    #login-section button {
        width: 100%;
        margin: 8px 0;
        font-size: 18px;
        padding: 15px;
    }

    #room-code-input { width: 100% !important; }

    .number-box    { width: 42px; height: 42px; line-height: 42px; font-size: 14px; }
    .grid-row      { gap: 5px; }
    .die           { width: 52px; height: 52px; }
    .dice-container { gap: 12px; }
}

/* ============================================================
   Board-scoped Notifications
   ============================================================ */
.player-board {
    position: relative; /* needed for notification positioning */
}

.board-notification {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-weight: 900;
    font-size: clamp(1.4em, 4vw, 2.2em);
    line-height: 1.15;
    text-align: center;
    pointer-events: none;
    z-index: 50;
    animation: notif-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: opacity 0.4s ease;
    padding: 8px;
}

.board-notification-fade {
    opacity: 0;
}

@keyframes notif-pop {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* Penalty / Oh No / Pick a Number */
.notif-penalty {
    background: rgba(211, 47, 47, 0.88);
    color: white;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
    border: 3px solid #b71c1c;
}

/* Doubles */
.notif-doubles {
    background: rgba(56, 142, 60, 0.88);
    color: white;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
    border: 3px solid #1b5e20;
}

/* Got It Already */
.notif-got-it {
    background: rgba(245, 124, 0, 0.88);
    color: white;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
    border: 3px solid #e65100;
}

/* Roll Em */
.notif-roll-em {
    background: rgba(21, 101, 192, 0.88);
    color: white;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
    border: 3px solid #0d47a1;
}
