* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #0d0b10;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    color: #f7f4ef;
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
select {
    font: inherit;
}

img {
    display: block;
    max-width: 100%;
}

.game-shell {
    width: 100%;
    max-width: 430px;
    min-height: 100vh;
    background:
        radial-gradient(circle at top, rgba(187, 34, 51, 0.55), transparent 32%),
        linear-gradient(180deg, #241115 0%, #131216 40%, #0f1118 100%);
    overflow-x: hidden;
    padding-bottom: 84px;
    position: relative;
}

.topbar {
    padding: 18px 18px 10px;
    background: rgba(10, 10, 12, 0.75);
    border-bottom: 1px solid rgba(255, 215, 120, 0.15);
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(10px);
}

.eyebrow {
    margin: 0 0 6px;
    font-size: 12px;
    text-transform: uppercase;
    color: #f0c36f;
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
}

.topbar-stats {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.topbar-stats span,
.pill,
.stat-pill {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
}

.pill-new {
    background: rgba(70, 188, 123, 0.18);
    border-color: rgba(70, 188, 123, 0.3);
}

.pill-dup {
    background: rgba(255, 180, 83, 0.18);
    border-color: rgba(255, 180, 83, 0.3);
}

.content {
    padding: 16px;
}

.panel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 14px;
}

.panel h2,
.panel h3,
.section-title {
    margin-top: 0;
}

.flash {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}

.flash-success {
    background: rgba(46, 204, 113, 0.16);
    border: 1px solid rgba(46, 204, 113, 0.28);
}

.flash-error {
    background: rgba(255, 99, 99, 0.16);
    border: 1px solid rgba(255, 99, 99, 0.28);
}

.flash-info {
    background: rgba(79, 134, 247, 0.14);
    border: 1px solid rgba(79, 134, 247, 0.28);
}

.button,
button {
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 13px 14px;
    background: linear-gradient(180deg, #d33f49 0%, #a21f2c 100%);
    color: #fff7ef;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
}

.button.secondary,
button.secondary {
    background: rgba(255, 255, 255, 0.1);
}

.button.gold,
button.gold {
    background: linear-gradient(180deg, #f0c95f 0%, #bb8533 100%);
    color: #1a1307;
}

.button:disabled,
button:disabled,
select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.menu-grid,
.summary-grid,
.npc-list,
.figure-grid,
.inventory-grid,
.stack-list {
    display: grid;
    gap: 12px;
}

.menu-grid,
.summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-box {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 12px;
}

.summary-box strong {
    display: block;
    font-size: 18px;
    margin-top: 4px;
}

.npc-card,
.inventory-card,
.figure-card,
.battle-log,
.team-slot,
.skill-item {
    background: rgba(0, 0, 0, 0.22);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px;
}

.is-locked {
    opacity: 0.55;
}

.figure-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.figure-list,
.stack-list {
    grid-template-columns: minmax(0, 1fr);
}

.figure-card {
    position: relative;
    overflow: hidden;
}

.figure-art {
    width: 100%;
    height: 230px;
    object-fit: contain;
    border-radius: 8px;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03)),
        linear-gradient(180deg, #432028 0%, #171a26 100%);
    padding: 10px;
}

.figure-card-image {
    width: 100%;
    height: 120px;
    overflow: hidden;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03)),
        linear-gradient(180deg, #432028 0%, #171a26 100%);
}

.figure-card-crop {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.simple-card {
    min-height: 210px;
    padding: 0;
    background: rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
}

.figure-name-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 700;
    max-width: calc(100% - 20px);
}

.figure-overlay,
.figure-card-footer {
    padding: 10px 12px 12px;
}

.figure-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    gap: 4px;
    min-height: 78px;
    background: linear-gradient(180deg, rgba(9, 9, 12, 0.05), rgba(9, 9, 12, 0.92) 45%);
    font-size: 12px;
}

.detail-panel {
    text-align: center;
}

.figure-detail-hero {
    width: 100%;
    max-height: 420px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-art,
.reveal-figure {
    width: 100%;
    max-width: 100%;
    max-height: 420px;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03)),
        linear-gradient(180deg, #432028 0%, #171a26 100%);
    padding: 14px;
}

.reveal-card {
    text-align: center;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    font-size: 13px;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 10px;
}

.form-stack {
    display: grid;
    gap: 12px;
}

.button-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.inline-form {
    margin: 0;
}

.select {
    width: 100%;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(12, 12, 14, 0.9);
    color: #f7f4ef;
    padding: 12px;
}

.battle-log {
    max-height: 480px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.5;
}

.battle-log p {
    margin: 0 0 8px;
}

.skill-item strong {
    display: block;
    margin-bottom: 6px;
}

.rarity-C { border-color: #9ea4ad; }
.rarity-R { border-color: #4b83ff; }
.rarity-SR { border-color: #8b4dff; }

.small-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 430px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    background: rgba(8, 8, 10, 0.94);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.bottom-nav a {
    padding: 14px 8px 18px;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
}

.bottom-nav a.active {
    color: #f0c36f;
    font-weight: 700;
}
