/* ===========================================
   HUD-CONTROLS.CSS v1.0.0
   Consolidated: hud-core + notes-manager +
                 share-ui + interactions (HUD)
   =========================================== */

/* ---- HUD BAR ---- */
.game-info {
    position: relative !important;
    z-index: 1000 !important;
    width: 100% !important;
    margin: 0 auto;
    padding: 9px 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px !important;
    background: transparent;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transition: opacity .3s ease !important;
}

.game-stats-container {
    width: 100% !important;
    display: flex;
    flex-direction: row;
    gap: 0;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    position: relative;
    min-height: 80px !important;
}

.game-stats {
    position: relative !important;
    z-index: 1001 !important;
    width: 100% !important;
    max-width: 555px !important;
    display: flex;
    align-items: flex-start;
    justify-content: space-between !important;
    gap: 0 !important;
    background: rgba(255, 255, 255, .9);
    padding: 8px 8px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 4px !important;
    position: relative;
    min-width: auto !important;
    gap: 4px !important;
}

.stat-item:hover {
    transform: translateY(-1px);
}

.stat-item:not(:last-child)::after {
    content: "";
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateX(50%) translateY(-50%);
    width: 1px !important;
    height: 30px !important;
    background: linear-gradient(to bottom, transparent, rgba(229, 229, 234, .4), rgba(199, 199, 204, .8), rgba(229, 229, 234, .4), transparent);
}

.stat-label {
    font-size: 12px !important;
    font-weight: 600;
    color: #374151;
    margin-bottom: 3px;
    letter-spacing: .5px;
    text-transform: uppercase;
    line-height: 1;
    height: 14px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 19px !important;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
    min-width: 54px !important;
    min-height: 37px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.stat-value.score {
    font-size: 25px !important;
    min-width: 67px !important;
    font-variant-numeric: tabular-nums;
}

.stat-value[id="game-time"] {
    min-width: 60px !important;
    font-variant-numeric: tabular-nums;
}

.stat-value.score.negative-score {
    color: #dc2626;
    animation: negativeScorePulse 2s infinite;
    filter: drop-shadow(0 0 4px rgba(220, 38, 38, .3));
}

@keyframes negativeScorePulse {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(220, 38, 38, .3)); transform: scale(1); }
    50% { filter: drop-shadow(0 0 8px rgba(220, 38, 38, .5)); transform: scale(1.02); }
}

/* ---- TROPHY ICON ---- */
.trophy-icon {
    font-size: 37px !important;
    color: #f59e0b;
    filter: drop-shadow(0 1px 2px rgba(245, 158, 11, .3));
    display: flex;
    align-items: center;
    justify-content: center;
}

.trophy-icon img {
    width: 59px !important;
    height: 59px !important;
    display: inline-block;
    vertical-align: middle;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

#trophy-indicator .stat-label {
    display: none !important;
}

/* ---- HINT ICON ---- */
.hint-item .stat-value {
    font-size: 26px !important;
    cursor: pointer;
    min-width: auto !important;
    width: auto !important;
}

.hint-icon {
    font-size: 26px !important;
    cursor: pointer !important;
    min-width: auto !important;
    width: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hint-icon img {
    width: 44px;
    height: 44px;
    display: inline-block;
    vertical-align: middle;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.hint-icon:hover img {
    transform: scale(1.1);
    animation: bulbGlow 1.2s ease-in-out infinite;
}

.hint-icon:active img {
    transform: scale(0.95);
}

@keyframes bulbGlow {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 0 transparent); }
    50% { filter: brightness(1.1) drop-shadow(0 0 4px rgba(255, 215, 0, .5)); }
}

/* ---- SHARE ICON ---- */
.share-item {
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-item .stat-value {
    font-size: 26px !important;
    cursor: pointer;
    min-width: auto !important;
    width: auto !important;
}

.share-icon {
    font-size: 26px !important;
    cursor: pointer !important;
    min-width: auto !important;
    width: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.share-icon:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.4));
}

.share-icon:active {
    transform: scale(0.95);
}

.share-icon svg {
    transition: color 0.2s ease;
}

.share-icon:hover svg {
    color: #D97706 !important;
}

.share-icon img {
    transition: filter 0.2s ease;
}

.share-icon:hover img {
    filter: brightness(1.1);
}

/* ---- ACTION BUTTONS ---- */
.action-buttons {
    position: absolute !important;
    z-index: 2000 !important;
    left: calc(50% + var(--grid-size-desktop) / 2 + 20px) !important;
    bottom: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 4px !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

#correct-btn,
#reveal-btn {
    min-width: 102px !important;
    width: 102px !important;
    height: 38px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 10px !important;
    font-size: 14px !important;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
    padding: 8px 10px !important;
    border: 1px solid #e2e8f0 !important;
}

#reveal-btn.hidden-ranked {
    display: none !important;
}

#correct-btn {
    background: linear-gradient(135deg, #fff, #f8fafc);
    color: #6b7280;
    opacity: .6;
    cursor: not-allowed;
    pointer-events: none;
}

#correct-btn.active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: transparent;
    color: #fff;
    opacity: 1;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(239, 68, 68, .3);
    animation: correctPulse 2.5s infinite;
}

#correct-btn.active:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, .4);
}

@keyframes correctPulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(239, 68, 68, .3); }
    50% { box-shadow: 0 6px 20px rgba(239, 68, 68, .5); }
}

#reveal-btn {
    background: linear-gradient(135deg, #fff, #f8fafc);
    color: #374151;
}

#reveal-btn:hover {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.reveal-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ---- NOTES: CONTROLS ---- */
#desktop-controls-container {
    position: absolute !important;
    left: calc(50% + var(--grid-size-desktop) / 2 + 20px) !important;
    top: -37px !important;
    z-index: 1100 !important;
    width: var(--controls-width) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    direction: ltr !important;
    text-align: left !important;
    overflow: visible !important;
}

#mobile-controls-container {
    display: none !important;
}

.control-section {
    margin-bottom: 4px;
    flex: 1 1 0;
    direction: ltr !important;
    text-align: left !important;
    overflow: visible !important;
}

.control-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 4px;
    direction: ltr !important;
    width: 100% !important;
    overflow: visible !important;
}

.number-grid,
.color-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    direction: ltr !important;
    text-align: left !important;
}

.number-btn,
.color-btn {
    width: var(--control-btn-width, 66px);
    height: var(--control-btn-height, 66px);
    background-color: #d6dae8;
    border: var(--control-btn-border, 2px) solid transparent;
    border-radius: var(--control-btn-radius, 8px);
    font-weight: 400;
    cursor: pointer;
    font-size: var(--control-btn-font, 28px);
    margin: var(--control-btn-margin, 1px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    box-sizing: border-box;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    direction: ltr !important;
    text-align: center !important;
}

.number-btn:hover:not(:disabled) {
    background-color: rgba(200, 205, 224, 0.3);
    border-color: #a0a4b0;
}

.number-btn:active:not(:disabled) {
    transform: scale(0.955);
}

.color-btn {
    background-color: #fff;
    position: relative;
}

.color-btn:hover:not(:disabled) {
    border-color: #8e8e93;
}

.color-btn:active:not(:disabled) {
    transform: scale(0.955);
}

.number-btn.notes-mode {
    background-color: #007AFF !important;
    color: white !important;
    border-color: #007AFF !important;
}

.color-btn.notes-mode {
    border-color: #007AFF !important;
    box-shadow: 0 0 0 1px rgba(0, 122, 255, 0.3);
}

.number-btn:disabled,
.color-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---- NOTES: COLOR CLASSES ---- */
.color-yellow  { background-color: #FFEB6A; }
.color-orange  { background-color: #FFBB45; }
.color-red     { background-color: #FF8A7A; }
.color-green   { background-color: #5BD87A; }
.color-brown   { background-color: #C9A387; }
.color-pink    { background-color: #FFA8CB; }
.color-cyan    { background-color: #64EAE6; }
.color-blue    { background-color: #5DB2FF; }
.color-purple  { background-color: #BEA1E5; }

/* ---- NOTES: PENCIL TOGGLE ---- */
.notes-toggle {
    background: linear-gradient(135deg, #ffffff, #f2f2f7);
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    width: var(--crayon-width, 66px);
    height: var(--crayon-height, 33px);
    min-width: var(--crayon-width, 66px);
    min-height: var(--crayon-height, 33px);
    padding: 2px 10px;
    font-size: var(--crayon-font, 16px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-weight: 500;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease;
    direction: ltr !important;
    text-align: center !important;
    position: relative;
    overflow: visible !important;
}

.notes-toggle::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    z-index: 10;
}

.notes-toggle:hover:not(:disabled) {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-color: #adb5bd;
}

.notes-toggle .pencil-icon {
    font-size: var(--crayon-icon, 22px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notes-toggle .pencil-icon img {
    width: 22px;
    height: 22px;
    display: block;
    transition: transform 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

.notes-toggle:hover:not(:disabled) .pencil-icon img {
    animation: pencil-wiggle 0.8s linear infinite;
}

@keyframes pencil-wiggle {
    0%   { transform: translateX(0); }
    25%  { transform: translateX(-2px); }
    75%  { transform: translateX(2px); }
    100% { transform: translateX(0); }
}

.notes-toggle.active {
    background: linear-gradient(135deg, #007AFF, #0056CC) !important;
    color: white !important;
    border-color: #007AFF !important;
    box-shadow: 0 2px 12px rgba(0, 122, 255, 0.3) !important;
}

.notes-toggle.active .pencil-icon img {
    filter: brightness(2);
}

.notes-toggle:disabled {
    background: linear-gradient(135deg, #f5f5f5, #e5e5e5) !important;
    color: #999 !important;
    border-color: #ddd !important;
    cursor: not-allowed !important;
    opacity: 0.5 !important;
}

/* ---- NOTES: IN-CELL DISPLAY ---- */
.cell-notes {
    position: absolute;
    inset: 2px;
    display: grid;
    grid-template-rows: repeat(4, 1fr);
    gap: 1px;
    pointer-events: none;
    z-index: 25;
    direction: ltr !important;
    text-align: left !important;
}

.notes-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1px;
    height: 100%;
    direction: ltr !important;
}

.note-item {
    width: 9.5px;
    height: 9.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1px;
    flex-shrink: 0;
    direction: ltr !important;
    text-align: center !important;
}

.note-number {
    font-size: 12px;
    font-weight: 700;
    color: #333;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
    line-height: 1;
}

.note-color {
    border-radius: 50%;
    border: 0.5px solid rgba(0, 0, 0, 0.4);
}

/* ---- SHARE MENU (dropdown) ---- */
.share-btn {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-family: var(--font-family, Inter, sans-serif);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.share-btn:active {
    transform: translateY(0);
}

.share-btn-icon {
    width: 18px;
    height: 18px;
}

.share-menu {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 12px;
    z-index: 10000;
    display: none;
    min-width: 200px;
    animation: shareMenuFadeIn 0.2s ease;
}

.share-menu.visible {
    display: block;
}

@keyframes shareMenuFadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.share-menu-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    margin-bottom: 8px;
}

.share-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
    color: #333;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-family, Inter, sans-serif);
}

.share-menu-item:hover {
    background: #f5f5f5;
}

.share-menu-item-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.share-menu-item-icon.twitter  { background: #1DA1F2; color: white; }
.share-menu-item-icon.facebook { background: #4267B2; color: white; }
.share-menu-item-icon.whatsapp { background: #25D366; color: white; }
.share-menu-item-icon.copy     { background: #6c757d; color: white; }
.share-menu-item-icon.download { background: #28a745; color: white; }

.share-menu-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 0;
}

.share-menu-subtitle {
    font-size: 11px;
    color: #888;
    padding: 4px 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.share-menu-item-badge {
    font-size: 9px;
    background: #eee;
    color: #666;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}

.share-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
}

.share-menu-overlay.visible {
    display: block;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .trophy-icon img {
        width: 47px !important;
        height: 47px !important;
    }
    .hint-icon img {
        width: 35px;
        height: 35px;
    }
    .notes-toggle .pencil-icon img {
        width: 18px;
        height: 18px;
    }
}

/* ---- DARK MODE ---- */
@media (prefers-color-scheme: dark) {
    .trophy-icon img,
    .hint-icon img,
    .notes-toggle .pencil-icon img {
        filter: brightness(1.1);
    }
}
