.tama-body {
    background: linear-gradient(160deg, #fff5f8, #fce8f2, #f2eaff);
    padding: 12px;
}

.tama-select {
    display: grid;
    grid-template-columns:repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.tama-slot {
    border: 2px solid var(--dark);
    border-radius: 12px;
    padding: 6px;
    text-align: center;
    cursor: pointer;
    background: white;
    transition: background .15s, box-shadow .15s;
    position: relative;
}

.tama-slot:hover, .tama-slot.on {
    background: #ffe4f0;
    box-shadow: 0 2px 8px rgba(233, 30, 140, 0.15);
}

.tama-slot img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.tama-slot span {
    font-family: 'Press Start 2P', monospace;
    font-size: 4px;
    color: var(--dark);
    display: block;
    margin-top: 2px;
}

.tama-slot .tdead {
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 9px;
}

.tama-empty {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: #aaa;
    text-align: center;
    padding: 14px;
    line-height: 2;
}

.tama-main {
    background: #e5f3fd;
    border-radius: 12px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.tama-top-section {
    display: flex;
    gap: 12px;
    align-items: center;
}

.tama-portrait {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffe1ee 30%, #ffcbe1 100%);
    border: 3px solid #f72585;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tama-kaomoji-bubble {
    position: absolute;
    top: -6px;
    left: 55%;
    background: white;
    border: 3px solid #f72585;
    border-radius: 20px;
    padding: 4px 10px;
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 900;
    color: #f72585;
    white-space: nowrap;
    z-index: 2;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
    animation: bubblePop .3s cubic-bezier(.34, 1.56, .64, 1);
}

.tama-char {
    width: 90px;
    height: 90px;
    object-fit: contain;
}

.tama-char.happy { animation: tfloat 2s ease-in-out infinite; }
.tama-char.sad { animation: tshake .5s ease-in-out infinite; filter: grayscale(40%); }
.tama-char.dead { filter: grayscale(100%); opacity: .4; }
.tama-char.tpulse { animation: tpulse .5s cubic-bezier(.34, 1.56, .64, 1); }

.tama-info {
    flex: 1;
    min-width: 0;
}

.tama-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #f72585;
    margin-bottom: 4px;
}

.tama-subtitle {
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: #888;
    margin-bottom: 12px;
}

.tama-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tama-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tama-bar-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 5px;
    color: var(--dark);
    width: 44px;
    flex-shrink: 0;
}

.tama-bar {
    flex: 1;
    height: 12px;
    background: #e8e8e8;
    border-radius: 10px;
    border: 2px solid var(--dark);
    overflow: hidden;
}

.tama-fill {
    height: 100%;
    border-radius: 10px;
    transition: width .5s;
}
.tama-fill.happy { background: linear-gradient(90deg, #ff6baf, #f72585); }
.tama-fill.hunger { background: linear-gradient(90deg, #ffdd6b, #f5c842); }
.tama-fill.energy { background: linear-gradient(90deg, #a6ed82, #7ed957); }

.tama-bar-pct {
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: var(--dark);
    width: 24px;
    text-align: right;
    flex-shrink: 0;
}

.tama-msg {
    background: white;
    border: 3px solid var(--dark);
    border-radius: 20px;
    padding: 10px 14px;
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: var(--dark);
    text-align: center;
    line-height: 1.5;
}

.tama-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.tama-btn {
    border: 3px solid var(--dark);
    border-radius: 14px;
    padding: 10px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--dark);
    transition: transform .1s, box-shadow .1s;
    background: white;
}
.tama-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--dark);
}
.tama-btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: none;
}
.tama-btn:disabled {
    filter: grayscale(100%);
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.tama-btn.feed { background: #ffcf54; }
.tama-btn.play { background: #f72585; }
.tama-btn.pet { background: #d8b4e2; }
.tama-btn.sleep { background: #7dd3fc; }

.btn-icon {
    font-size: 22px;
}

.btn-text {
    font-family: 'Press Start 2P', monospace;
    font-size: 5px;
}
.tama-btn.feed .btn-text { color: var(--dark); }
.tama-btn.play .btn-text { color: white; }
.tama-btn.pet .btn-text { color: white; }
.tama-btn.sleep .btn-text { color: var(--dark); }

/* ════════════════════════════════
   TAMA HUD — tamagotchi device widget
   ════════════════════════════════ */

#tama-hud {
    user-select: none;
    animation: thudIn .22s ease-out both;
}

/* Device body — egg-shaped plastic shell */
.thud-device {
    background: linear-gradient(160deg, #ff8ecb 0%, #f72585 42%, #d4006d 100%);
    border: 3px solid var(--dark);
    border-radius: 46% 46% 44% 44% / 50% 50% 42% 42%;
    box-shadow: 0 6px 0 var(--dark), 4px 10px 24px rgba(0,0,0,.25);
    width: 220px;
    overflow: hidden;
    position: relative;
}

/* Plastic sheen across the top */
.thud-device::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 38%;
    background: linear-gradient(180deg, rgba(255,255,255,.28), transparent);
    border-radius: 46% 46% 0 0 / 50% 50% 0 0;
    pointer-events: none;
    z-index: 1;
}

/* Drag handle — labelled top strip */
.thud-top {
    padding: 36px 12px 5px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 5px;
    color: #fff;
    letter-spacing: .5px;
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 3px rgba(0,0,0,.35);
}

.thud-top:active { cursor: grabbing; }

/* Screen — warm cream, framed with a pink ring */
.thud-screen-bezel {
    margin: 2px 30px 10px;
    background: #fff5e8;
    border: 3px solid var(--dark);
    border-radius: 8px;
    padding: 10px;
    box-shadow: inset 0 1px 6px rgba(0,0,0,.07);
    position: relative;
    z-index: 2;
}

/* Screen content area */
.thud-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-height: 112px;
    justify-content: center;
}

/* Alien image inside screen */
.thud-alien-img { display: flex; align-items: center; justify-content: center; }

.thud-alien-img img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 1px 4px rgba(247,37,133,.2));
    animation: tfloat 2.2s ease-in-out infinite;
}

.thud-alien-img.thud-dead img {
    filter: grayscale(100%) opacity(.4);
    animation: none;
}

.thud-alien-img img.thud-react {
    animation: tpulse .55s cubic-bezier(.34,1.56,.64,1);
}

.thud-alien-img img.thud-react-play {
    animation: tshake .5s ease-in-out;
}

/* Alien name on screen */
.thud-alien-name {
    font-family: var(--font-display);
    font-size: 5px;
    color: #c01060;
    letter-spacing: .3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
    text-align: center;
}

/* Stat bars on screen */
.thud-bars {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.thud-bar-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.thud-bar-label { font-size: 8px; line-height: 1; flex-shrink: 0; }

.thud-bar-track {
    flex: 1;
    height: 5px;
    background: rgba(0,0,0,.1);
    border-radius: 3px;
    overflow: hidden;
}

.thud-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: none;
}

.thud-bar-fill.thud-happy  { background: linear-gradient(90deg, #ff6baf, #f72585); }
.thud-bar-fill.thud-hunger { background: linear-gradient(90deg, #ffdd6b, #f5c842); }
.thud-bar-fill.thud-energy { background: linear-gradient(90deg, #a6ed82, #7ed957); }

/* Dead message on screen */
.thud-dead-msg {
    font-family: var(--font-display);
    font-size: 5px;
    color: #c01060;
    text-align: center;
}

/* Button strip — round plastic keys at the bottom */
.thud-controls {
    display: flex;
    justify-content: center;
    gap: 9px;
    padding: 5px 10px 50px;
    position: relative;
    z-index: 2;
}

.thud-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--dark);
    transition: transform .08s, box-shadow .08s;
}

.thud-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--dark);
}

.thud-btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: none;
}

.thud-btn:disabled {
    opacity: .38;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.thud-feed  { background: #ffcf54; }
.thud-play  { background: #f72585; }
.thud-pet   { background: #ffb3e0; }
.thud-sleep { background: #a5d8ff; }
