body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: #f4f6f8;
    color: #1f2933;
}

/* --- Header / User Info --- */
header {
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #374151;
}

.user-info svg {
    width: 24px;
    height: 24px;
    fill: #2563eb;
}

.hidden { display: none; }

/* --- Dashboard tile grid --- */
.dashboard {
    padding: 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
}

.tile {
    background: white;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.tile-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

/* --- Shared button styles --- */
button {
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 1rem;
    cursor: pointer;
    margin: 4px;
}

/* Neutralise the global button margin/padding inside the whiteboard shell so
   its own toolbar, nav, and close-button styles are not disturbed. The whiteboard
   sets explicit margins on every class it cares about, so this is a safe reset. */
#wb-root button {
    margin: 0;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

.primary {
    background: #2563eb;
    color: white;
}

.secondary {
    background: #9ca3af;
    color: white;
}

/* --- App card (used by timer and other apps) --- */
.timer-card {
    max-width: 420px;
    margin: auto;
    background: white;
    padding: 32px;
    border-radius: 16px;
    text-align: center;
}

.highlight-flash {
    animation: flash 0.4s ease-in-out;
}

@keyframes flash {
    0% { background-color: #fff3cd; }
    100% { background-color: white; }
}

.die {
    user-select: none;
    cursor: default;
    text-align: center;
    font-weight: bold;
}

svg {
    margin: 16px auto;
}

/* --- Modal App Display --- */
#appModal {
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,0.95);
    display: none; /* hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: max(32px, env(safe-area-inset-top)) max(32px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(32px, env(safe-area-inset-left));
}

#appModalContent {
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px;
    position: relative;
    display: flex;
    flex-direction: column;
}

#appContainer {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

/* --- Fullscreen modal mode --- */
#appModal.fullscreen #appModalContent {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    padding: 32px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10001;
    pointer-events: auto;
}

/* --- App content wrapper (no extra padding; apps manage their own spacing) --- */
.app {
    padding: 0;
}

/* ─── Whiteboard tool info buttons ─────────────────────────────────────── */
#wb-root .wb-tile-info-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.12);
    color: #374151;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    line-height: 1;
    z-index: 2;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.15s;
}
#wb-root .wb-tile-info-btn:hover {
    opacity: 1;
    background: rgba(37, 99, 235, 0.18);
}
.wb-tile-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2933;
    color: white;
    font-size: 0.78rem;
    line-height: 1.4;
    padding: 8px 10px;
    border-radius: 8px;
    width: 200px;
    text-align: center;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.wb-tile-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1f2933;
}
