/* =========================================================
   Helpalot Poetry Invader – Styles
   Minimal retro feel. Mobile-first.
   ========================================================= */

@font-face {
    font-family: 'Bungee';
    src: url('../fonts/Bungee-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

.pi-root {
    font-family: 'Bungee', monospace;
    background: #0c0c0c;
    color: #d8d8c8;
    max-width: 560px;
    margin: 0 auto;
    padding: 12px;
    box-sizing: border-box;
}

.pi-root *, .pi-root *::before, .pi-root *::after {
    box-sizing: inherit;
}

.pi-hidden { display: none !important; }

/* ── Intro / Over screens ── */
.pi-intro, .pi-over {
    text-align: center;
    padding: 48px 16px;
}

.pi-title {
    font-size: clamp(1.8rem, 7vw, 3rem);
    margin: 0 0 20px;
    letter-spacing: 0.04em;
}

.pi-desc, .pi-keys {
    font-size: 0.8rem;
    margin: 0 0 10px;
    opacity: 0.6;
    letter-spacing: 0.03em;
}

/* ── Buttons ── */
.pi-btn {
    font-family: inherit;
    font-size: 0.78rem;
    padding: 8px 20px;
    border: 2px solid #d8d8c8;
    background: transparent;
    color: #d8d8c8;
    cursor: pointer;
    letter-spacing: 0.08em;
    margin-top: 20px;
}

.pi-btn--primary {
    background: #d8d8c8;
    color: #0c0c0c;
}

.pi-btn:hover { opacity: 0.75; }

/* ── HUD ── */
.pi-hud {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 4px 2px;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.pi-feedback {
    text-align: center;
    min-height: 1.2em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.pi-feedback--fade {
    opacity: 0;
}

.pi-hud-right {
    text-align: right;
    white-space: nowrap;
}

/* ── Arena ── */
.pi-arena {
    position: relative;
    width: 100%;
    height: 440px;
    border: 2px solid #333;
    overflow: hidden;
    background: #0c0c0c;
}

/* ── Lines ── */
.pi-line {
    position: absolute;
    left: 0;
    right: 0;
    white-space: nowrap;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-align: center;
}

.pi-word { display: inline; }

.pi-word--changed {
    color: #4da6ff;
    transition: color 5s ease-out;
}

.pi-word--no-replacement {
    color: #ff9933;
    transition: color 5s ease-out;
}

/* ── Ship ── */
.pi-ship {
    position: absolute;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    padding: 4px 8px;
    border: 2px solid #d8d8c8;
}

.pi-ship-charge {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    pointer-events: none;
}

@keyframes pi-ship-flash {
    0%   { background: rgba(216,216,200,0.35); }
    100% { background: transparent; }
}

.pi-ship--flash {
    animation: pi-ship-flash 0.2s ease-out forwards;
}

/* ── Bullet ── */
.pi-bullet {
    position: absolute;
    width: 2px;
    height: 12px;
    background: #d8d8c8;
}

/* ── Ticker ── */
.pi-ticker-wrap {
    overflow: hidden;
    border: 2px solid #333;
    border-top: none;
    height: 28px;
    padding: 3px 6px;
    margin-bottom: 8px;
    text-align: center;
}

.pi-ticker-inner {
    display: inline-block;
    white-space: nowrap;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    opacity: 0.55;
}

.pi-ticker-first {
    opacity: 1;
    font-weight: bold;
}

/* ── Mobile controls ── */
.pi-controls {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.pi-ctrl {
    font-family: inherit;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    flex: 1;
    padding: 16px 0;
    border: 2px solid #2a2a2a;
    background: transparent;
    color: #d8d8c8;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.pi-ctrl:active { background: #1a1a1a; }

.pi-over {
    text-align: center;
    padding: 48px 16px;
}

.pi-final-poem {
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 4px;
    padding: 20px 16px;
    margin: 16px 0;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    line-height: 1.8;
    max-height: 250px;
    overflow-y: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.pi-final-words {
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 4px;
    padding: 20px 16px;
    margin: 16px 0;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
    word-wrap: break-word;
}
@media (max-width: 480px) {
    .pi-arena { height: 360px; }
    .pi-root  { padding: 8px; }
    .pi-title { font-size: clamp(1.4rem, 6vw, 2rem); }
}
