*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f1117;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 24px 16px;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 16px; border: none; border-radius: 6px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    text-decoration: none; transition: all 0.15s;
}
.btn:disabled { cursor: not-allowed; }

.btn-submit { background: #22c55e; color: #0f1117; }
.btn-submit:hover { background: #4ade80; }
.btn-submit:disabled { background: #1a3a2a; color: #4b7a5a; }

.btn-hint { background: #a78bfa; color: #0f1117; }
.btn-hint:hover { background: #c4b5fd; }
.btn-hint:disabled { background: #2d2640; color: #5b4a7a; }

.btn-solve { background: #f0b860; color: #0f1117; }
.btn-solve:hover { background: #f5cc80; }

.btn-primary { background: #7cacf8; color: #0f1117; }
.btn-primary:hover { background: #9dbffa; }

/* Loading / error */
.loading-msg { color: #9ca3af; font-size: 14px; margin-top: 12px; }
.error-msg { color: #f87171; font-size: 14px; margin-top: 8px; }

/* Phone frame */
.phone-frame { max-width: 420px; width: 100%; }

/* Header */
.play-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.play-header h1 { font-size: 28px; margin: 0; }
.play-info { display: flex; gap: 16px; align-items: center; font-size: 14px; color: #9ca3af; }
.play-info .attempts { font-weight: 600; }

/* Empty state */
.empty-state { text-align: center; padding: 80px 20px; }
.empty-state h1 { font-size: 36px; margin-bottom: 16px; }
.empty-state p { color: #9ca3af; margin-bottom: 24px; font-size: 16px; }

/* Grid */
.grid-area { position: relative; width: 100%; margin: 0 auto 16px auto; min-height: 100px; }
.grid-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.tri-line { stroke: #2a2d37; stroke-width: 1; fill: none; }
.tri-hover-zone { cursor: pointer; transition: fill-opacity 0.15s; }
.tri-hover-zone:hover { fill-opacity: 0.18; }

/* Slots */
.node-slot {
    position: absolute;
    height: 44px;
    background: #1a1d27;
    border: 2px dashed #2a2d37;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 500; color: #e0e0e0;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    z-index: 2;
}
.node-slot:hover { border-color: #7cacf8; }
.node-slot.filled { border-style: solid; border-color: #3a4a5f; background: #222738; }
.node-slot.selected-target { border-color: #7cacf8; border-style: solid; box-shadow: 0 0 8px rgba(124,172,248,0.3); }
.node-slot.hint { background: #16192a; border: 2px solid #2a2d37; cursor: default; }
.node-slot.hint .hint-label { position: absolute; top: -8px; right: 6px; font-size: 9px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; background: #1a1d27; padding: 0 4px; }
.node-slot.correct { border-color: #22c55e; background: rgba(34,197,94,0.12); }
.node-slot.incorrect-flash { border-color: #ef4444; background: rgba(239,68,68,0.15); animation: flash-red 3s; }
.node-slot.trio-highlight { box-shadow: 0 0 0 2px var(--tri-color, #7cacf8); }

@keyframes flash-red {
    0% { background: rgba(239,68,68,0.3); }
    70% { background: rgba(239,68,68,0.15); }
    100% { background: rgba(239,68,68,0); }
}

/* Trio info bar */
.trio-info-bar {
    text-align: center; font-size: 13px; color: #e0e0e0;
    padding: 8px 12px;
    background: #1a1d27; border: 1px solid #2a2d37; border-radius: 6px;
    margin-top: 8px;
    opacity: 0; transition: opacity 0.15s;
}
.trio-info-bar .tt-line { display: block; line-height: 1.6; }
.trio-info-bar.visible { opacity: 1; }
.trio-info-bar .tt-tag { color: #7cacf8; font-weight: 600; }
.trio-info-bar .tt-words { color: #e0e0e0; }

/* Word bank */
.word-bank-section { margin-top: 8px; }
.word-bank-section h3 { font-size: 14px; color: #9ca3af; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.word-bank { display: flex; flex-wrap: wrap; gap: 6px; min-height: 44px; padding: 10px; background: #13151d; border: 1px solid #2a2d37; border-radius: 8px; margin: 0 auto; justify-content: center; }
.word-chip {
    padding: 6px 12px;
    background: #2a3547;
    border: 2px solid transparent;
    border-radius: 6px;
    font-size: 12px; font-weight: 500; color: #e0e0e0;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.word-chip:hover { background: #344158; }
.word-chip.selected { border-color: #7cacf8; background: #2a3a5a; }

/* Actions */
.actions-bar { display: flex; gap: 12px; margin-top: 20px; align-items: center; flex-wrap: wrap; justify-content: center; }

/* Reveal */
.reveal-section { margin-top: 32px; }
.reveal-section h3 { font-size: 16px; margin-bottom: 16px; }
.trio-card { background: #1a1d27; border: 1px solid #2a2d37; border-radius: 8px; padding: 14px 18px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.trio-card .trio-words { font-size: 14px; color: #e0e0e0; }
.trio-card .trio-tag { font-size: 13px; color: #7cacf8; font-weight: 500; }
