/* ==========================================================
   I-HEAR Tactile: Accessible Full-Screen CSS for Blind Users
   High-Contrast (WCAG 2.1 AAA), 4-Quadrant Zero-Dead-Zone Layout
   ========================================================== */

:root {
    --bg-black: #000000;
    --tile-bg: #0D1117;
    --tile-border-idle: #21262D;

    --color-cyan: #00E5FF;
    --color-gold: #FFD700;
    --color-coral: #FF3B30;
    --color-emerald: #00E676;

    --font-stack: -apple-system, BlinkMacSystemFont, "Sarabun", "Noto Sans Thai", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

html, body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    background-color: var(--bg-black);
    font-family: var(--font-stack);
    overflow: hidden;
    touch-action: manipulation;
}

/* Accessibility screen-reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Main 4-Quadrant Tactile Surface */
.tactile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    gap: 4px;
    background-color: #161B22;
}

/* Individual Full-Quadrant Tile */
.tactile-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: var(--tile-bg);
    border: 3px solid var(--tile-border-idle);
    border-radius: 0;
    padding: 16px;
    cursor: pointer;
    outline: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.tactile-tile:active {
    transform: scale(0.98);
}

/* Quadrant Themes */
.tile-cyan {
    border-color: rgba(0, 229, 255, 0.4);
}
.tile-cyan .tile-icon, .tile-cyan .tile-value {
    color: var(--color-cyan);
}

.tile-gold {
    border-color: rgba(255, 215, 0, 0.4);
}
.tile-gold .tile-icon, .tile-gold .tile-value {
    color: var(--color-gold);
}

.tile-coral {
    border-color: rgba(255, 59, 48, 0.4);
}
.tile-coral .tile-icon, .tile-coral .tile-value {
    color: var(--color-coral);
}

.tile-emerald {
    border-color: rgba(0, 230, 118, 0.4);
}
.tile-emerald .tile-icon, .tile-emerald .tile-value {
    color: var(--color-emerald);
}

/* Tile Internal Typography & Sizing */
.tile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    width: 100%;
}

.tile-icon {
    font-size: clamp(48px, 10vw, 76px);
    margin-bottom: 8px;
    line-height: 1;
}

.tile-title {
    font-size: clamp(18px, 4.5vw, 24px);
    font-weight: 700;
    color: #F0F6FC;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.tile-value {
    font-size: clamp(22px, 5.5vw, 32px);
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.tile-hint {
    font-size: clamp(12px, 3.2vw, 15px);
    color: #8B949E;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 12px;
    border-radius: 999px;
    transition: all 0.2s ease;
}

/* Confirmation Pending State (When tapped once) */
.tactile-tile.pending-confirm {
    background-color: #1A1A00 !important;
    border: 5px solid #FFD700 !important;
    animation: pulse-halo 1.2s infinite alternate;
}

.tactile-tile.pending-confirm .tile-hint {
    color: #000000;
    background-color: #FFD700;
    font-weight: 800;
    transform: scale(1.08);
}

@keyframes pulse-halo {
    0% {
        box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.25), 0 0 25px rgba(255, 215, 0, 0.4);
    }
    100% {
        box-shadow: inset 0 0 35px rgba(255, 215, 0, 0.5), 0 0 45px rgba(255, 215, 0, 0.8);
    }
}

/* Success Confirmation Flash */
.tactile-tile.confirmed-flash {
    background-color: #003314 !important;
    border-color: #00E676 !important;
    transition: background-color 0.1s ease;
}

/* Timeout Progress Bar along bottom of tile */
.tile-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 6px;
    width: 0%;
    background-color: #FFD700;
    pointer-events: none;
    transition: width 0.05s linear;
}

.tactile-tile.pending-confirm .tile-progress-bar {
    width: 100%;
    transition: width 3.5s linear;
}

/* Small Technician Link for trainers / sighted operators */
.technician-link {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    text-decoration: none;
    z-index: 999;
}
.technician-link:hover {
    color: #FFFFFF;
    border-color: rgba(255, 255, 255, 0.6);
}
