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

body {
    font-family: 'Courier New', monospace;
    background: #0a0a0a;
    color: #f5f5f5;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-user-select: none;
    user-select: none;
}

.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 50% 0%, hsla(0, 90%, 45%, 0.12) 0%, transparent 55%),
        linear-gradient(180deg, #0a0a0a 0%, #111111 45%, #1a0808 100%);
}

.header {
    padding: 16px 16px 8px;
    text-align: center;
    position: relative;
}

.hub-back {
    position: absolute;
    left: 12px;
    top: 18px;
    color: hsla(0, 0%, 100%, 0.6);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.hub-back:hover {
    color: #ff0040;
    background: hsla(0, 0%, 100%, 0.06);
}

.title {
    font-size: 1.35rem;
    letter-spacing: 0.12em;
    font-weight: bold;
    color: #fff;
    margin-bottom: 2px;
}

.title-x {
    display: inline-block;
    background: linear-gradient(135deg, #ff0040, #ff6600);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.5rem;
    font-weight: 900;
    margin-right: 4px;
    transform: skewX(-12deg);
}

.subtitle {
    font-size: 0.65rem;
    letter-spacing: 0.35em;
    color: hsla(0, 0%, 100%, 0.45);
    margin-bottom: 10px;
}

.hud {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.hud-stat {
    background: hsla(0, 0%, 8%, 0.85);
    border: 1px solid hsla(0, 90%, 50%, 0.35);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: bold;
}

.hud-icon {
    margin-right: 4px;
    color: #ff0040;
    font-weight: 900;
}

.tabs {
    display: flex;
    gap: 4px;
    padding: 0 8px;
    overflow-x: auto;
}

.tab {
    flex: 1;
    min-width: 0;
    padding: 10px 6px;
    border: none;
    background: hsla(0, 0%, 10%, 0.9);
    color: hsla(0, 0%, 70%, 0.8);
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: background 0.2s, color 0.2s;
}

.tab.active {
    background: hsla(0, 85%, 45%, 0.25);
    color: #fff;
    box-shadow: 0 -2px 8px hsla(0, 90%, 50%, 0.35);
    border-top: 2px solid #ff0040;
}

.tab:hover:not(.active) {
    background: hsla(280, 50%, 20%, 0.9);
    color: #fff;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 12px 16px;
}

.canvas-section {
    text-align: center;
    padding: 12px 0;
}

.canvas-wrap {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

#gameCanvas {
    display: block;
    border-radius: 50%;
    box-shadow:
        0 0 40px hsla(0, 90%, 50%, 0.25),
        0 0 80px hsla(0, 0%, 100%, 0.05);
    touch-action: manipulation;
}

.float-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: 50%;
}

.float-text {
    position: absolute;
    font-size: 0.85rem;
    font-weight: bold;
    color: #ff0040;
    text-shadow: 0 0 8px hsla(0, 90%, 50%, 0.8);
    animation: floatUp 0.8s ease-out forwards;
    pointer-events: none;
}

@keyframes floatUp {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-40px); }
}

.spin-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 12px;
}

.stat-row {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.65rem;
    color: hsla(0, 0%, 60%, 0.9);
    letter-spacing: 0.1em;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #ff0040;
}

.panel {
    display: none;
    flex: 1;
    overflow-y: auto;
    max-height: 340px;
    padding: 8px 0;
}

.panel.active {
    display: block;
}

.panel-hint {
    text-align: center;
    font-size: 0.8rem;
    color: hsla(280, 30%, 65%, 0.9);
    padding: 8px;
}

.upgrade-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upgrade-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: hsla(0, 0%, 8%, 0.9);
    border: 1px solid hsla(0, 60%, 35%, 0.35);
    border-radius: 10px;
    padding: 10px 12px;
}

.upgrade-card.locked {
    opacity: 0.5;
}

.upgrade-icon {
    font-size: 1.5rem;
    width: 36px;
    text-align: center;
}

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

.upgrade-name {
    font-size: 0.85rem;
    font-weight: bold;
}

.upgrade-desc {
    font-size: 0.7rem;
    color: hsla(280, 30%, 65%, 0.9);
}

.upgrade-level {
    font-size: 0.65rem;
    color: #ff6600;
}

.upgrade-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.upgrade-cost {
    font-size: 0.75rem;
    color: #ff6600;
}

.btn {
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-buy {
    background: linear-gradient(135deg, #ff0040, #ff6600);
    color: #fff;
}

.btn-max {
    background: hsla(280, 50%, 25%, 0.9);
    color: #fff;
    border: 1px solid hsla(280, 60%, 50%, 0.5);
}

.btn-sound {
    background: hsla(280, 40%, 20%, 0.8);
    color: hsla(280, 30%, 80%, 0.9);
    border: 1px solid hsla(280, 50%, 40%, 0.4);
    font-size: 0.65rem;
    padding: 4px 8px;
}

.btn-fight {
    background: linear-gradient(135deg, #ff0040, #cc0020);
    color: #fff;
    padding: 8px 16px;
}

.btn-prestige {
    background: linear-gradient(135deg, #ff0040, #ff6600);
    color: #fff;
    padding: 12px 24px;
    font-size: 0.9rem;
    margin-top: 16px;
    width: 100%;
    letter-spacing: 0.15em;
}

.battle-header {
    margin-bottom: 12px;
}

.stamina-bar-wrap {
    margin-bottom: 8px;
}

.stamina-bar-wrap label {
    font-size: 0.7rem;
    color: hsla(280, 30%, 65%, 0.9);
}

.stamina-bar {
    height: 10px;
    background: hsla(280, 40%, 15%, 0.8);
    border-radius: 5px;
    overflow: hidden;
    margin: 4px 0;
}

.stamina-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff0040, #ff6600);
    border-radius: 5px;
    transition: width 0.3s ease;
    width: 100%;
}

#staminaText {
    font-size: 0.7rem;
    color: hsla(280, 30%, 70%, 0.9);
}

.battle-log {
    font-size: 0.8rem;
    color: hsla(45, 80%, 60%, 0.95);
    padding: 8px;
    background: hsla(280, 40%, 10%, 0.6);
    border-radius: 8px;
    min-height: 36px;
}

.enemy-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.enemy-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: hsla(280, 40%, 12%, 0.8);
    border: 1px solid hsla(280, 50%, 30%, 0.4);
    border-radius: 10px;
    padding: 10px 12px;
}

.enemy-card.locked {
    opacity: 0.45;
}

.enemy-icon {
    font-size: 1.4rem;
}

.enemy-info {
    flex: 1;
}

.enemy-name {
    font-size: 0.85rem;
    font-weight: bold;
}

.enemy-power {
    font-size: 0.7rem;
    color: hsla(280, 30%, 65%, 0.9);
}

.enemy-reward {
    font-size: 0.7rem;
    color: #ff6600;
}

.prestige-panel {
    text-align: center;
    padding: 12px;
}

.prestige-panel h2 {
    font-size: 1rem;
    letter-spacing: 0.15em;
    margin-bottom: 8px;
    color: #ff0040;
}

.prestige-desc {
    font-size: 0.75rem;
    color: hsla(280, 30%, 65%, 0.9);
    margin-bottom: 16px;
}

.prestige-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.prestige-stat {
    background: hsla(280, 40%, 12%, 0.8);
    border-radius: 8px;
    padding: 10px;
}

.prestige-stat .label {
    display: block;
    font-size: 0.65rem;
    color: hsla(280, 30%, 60%, 0.9);
}

.prestige-stat .value {
    font-size: 1rem;
    font-weight: bold;
    color: #ff6600;
}

.prestige-lock {
    font-size: 0.75rem;
    color: hsla(45, 60%, 55%, 0.9);
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.achievement-card {
    background: hsla(280, 40%, 12%, 0.8);
    border: 1px solid hsla(280, 50%, 30%, 0.4);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    transition: opacity 0.2s;
}

.achievement-card.locked {
    opacity: 0.4;
}

.achievement-card.unlocked {
    border-color: hsla(45, 80%, 50%, 0.6);
    box-shadow: 0 0 12px hsla(45, 80%, 50%, 0.2);
}

.achievement-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.achievement-name {
    font-size: 0.75rem;
    font-weight: bold;
}

.achievement-desc {
    font-size: 0.6rem;
    color: hsla(280, 30%, 60%, 0.9);
}

.achievement-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    display: flex;
    align-items: center;
    gap: 12px;
    background: hsla(0, 0%, 8%, 0.95);
    border: 2px solid hsla(0, 90%, 50%, 0.8);
    border-radius: 12px;
    padding: 12px 16px;
    z-index: 9999;
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
    max-width: 90vw;
}

.achievement-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.achievement-notification .achievement-icon {
    font-size: 2rem;
}

.achievement-notification .achievement-title {
    font-size: 0.65rem;
    color: #ff0040;
    letter-spacing: 0.1em;
}

.achievement-notification .achievement-name {
    font-size: 0.9rem;
    font-weight: bold;
}

.achievement-notification .achievement-desc {
    font-size: 0.7rem;
    color: hsla(280, 30%, 70%, 0.9);
}

@media (max-width: 360px) {
    .title { font-size: 1rem; }
    .tab { font-size: 0.6rem; padding: 8px 4px; }
}

/* Blade stats & type system */
.blade-stats {
    margin: 10px auto 0;
    max-width: 320px;
    text-align: left;
    background: hsla(0, 0%, 6%, 0.9);
    border: 1px solid hsla(0, 60%, 35%, 0.35);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.72rem;
}

.blade-stats-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.blade-stats-name {
    font-weight: bold;
    font-size: 0.85rem;
}

.blade-parts {
    color: hsla(0, 0%, 60%, 0.9);
    font-size: 0.65rem;
}

.blade-desc, .launcher-line {
    color: hsla(0, 0%, 65%, 0.9);
    font-size: 0.65rem;
    line-height: 1.4;
    margin-top: 6px;
}

.stat-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.6rem;
    color: hsla(0, 0%, 55%, 0.9);
}

.stat-bar-row span:first-child {
    width: 28px;
}

.stat-bar {
    flex: 1;
    height: 6px;
    background: hsla(0, 0%, 15%, 0.9);
    border-radius: 3px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 3px;
}

.stat-bar-fill.atk { background: #ff0040; }
.stat-bar-fill.def { background: #4488ff; }
.stat-bar-fill.sta { background: #44cc88; }

.type-badge {
    display: inline-block;
    font-size: 0.55rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.type-attack { background: hsla(0, 90%, 45%, 0.25); color: #ff6688; border: 1px solid hsla(0, 90%, 50%, 0.4); }
.type-defense { background: hsla(220, 80%, 50%, 0.2); color: #88bbff; border: 1px solid hsla(220, 80%, 50%, 0.35); }
.type-stamina { background: hsla(150, 60%, 40%, 0.2); color: #66ddaa; border: 1px solid hsla(150, 60%, 45%, 0.35); }
.type-balance { background: hsla(40, 80%, 45%, 0.2); color: #ffcc66; border: 1px solid hsla(40, 80%, 50%, 0.35); }

.type-chart {
    margin-top: 10px;
    padding: 8px;
    background: hsla(0, 0%, 6%, 0.7);
    border-radius: 8px;
    text-align: center;
}

.type-chart-title {
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: hsla(0, 0%, 55%, 0.9);
    margin-bottom: 4px;
}

.type-chart-body {
    font-size: 0.65rem;
    color: hsla(0, 0%, 65%, 0.9);
}

.matchup-strong { color: #44cc88; font-weight: bold; }
.matchup-weak { color: #ff4466; font-weight: bold; }
.matchup-neutral { color: hsla(0, 0%, 60%, 0.9); }

.team-tag {
    font-size: 0.6rem;
    color: hsla(0, 0%, 50%, 0.9);
    font-weight: normal;
}

.enemy-bey {
    font-size: 0.72rem;
    color: hsla(0, 0%, 75%, 0.95);
    margin-bottom: 4px;
}

.enemy-desc {
    font-size: 0.65rem;
    color: hsla(0, 0%, 60%, 0.9);
    line-height: 1.35;
    margin-bottom: 4px;
}

.enemy-tactic {
    font-size: 0.62rem;
    color: #ff8800;
    margin-bottom: 4px;
}

.enemy-warn {
    font-size: 0.62rem;
    color: #ff4466;
    margin-top: 4px;
}

.battle-phase {
    font-size: 0.75rem;
    color: #ff6600;
    font-weight: bold;
    min-height: 18px;
    margin-bottom: 4px;
    letter-spacing: 0.05em;
}

.battle-detail {
    font-size: 0.65rem;
    color: hsla(0, 0%, 60%, 0.9);
    margin-top: 6px;
    line-height: 1.35;
}

.section-header {
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: hsla(0, 0%, 55%, 0.9);
    padding: 10px 4px 4px;
    border-top: 1px solid hsla(0, 40%, 30%, 0.3);
    margin-top: 6px;
}

.upgrade-card.equipped-card {
    border-color: hsla(0, 90%, 50%, 0.45);
}

.upgrade-card.maxed {
    opacity: 0.55;
}

.enemy-card {
    align-items: flex-start;
}

.enemy-card .btn-fight {
    flex-shrink: 0;
    margin-top: 4px;
}
