*{
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    margin: 0;
    padding: 0;
}
html, body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    background-color: #0b0c10;
    color: #c5c6c7;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
}
#game-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: calc(100% - 70px);
    max-width: 480px;
    margin: 0 auto;
    padding: 8px;
    gap: 6px;
}
/* ステータスカード */
.status-card {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    background: #1f2833;
    border: 1px solid #45a29e;
    border-radius: 8px;
    padding: 6px 2px;
    text-align: center;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.stat-box:active {
    opacity: 0.7;
}
.stat-label {
    font-size: 0.58rem;
    color: #66fcf1;
    font-weight: bold;
}
.stat-val {
    font-size: 0.78rem;
    font-weight: bold;
    color: #ffffff;
}
/* 主人公情報バー（HP配置） */
.hero-info-card {
    background: #1a232a;
    border: 1px solid #354656;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.7rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.main-hp-box {
    display: flex;
    align-items: center;
    gap: 6px;
}
/* トレンドカード */
.trend-card {
    background: linear-gradient(90deg, #2c1a38 0%, #1f2833 100%);
    border: 1px solid #bb86fc;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.72rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.trend-badge {
    background: #bb86fc;
    color: #000;
    font-weight: bold;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
}
/* メインレイアウト */
.main-row {
    display: flex;
    gap: 6px;
    flex: 1;
    min-height: 0;
}
.tab-panel {
    flex: 1.35;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;
}
.tab-content {
    display: none;
    flex-direction: column;
    gap: 5px;
}
.tab-content.active {
    display: flex;
}
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1f2833;
    border: 1px solid #354656;
    border-radius: 8px;
    padding: 6px;
    overflow: hidden;
}
.panel-header {
    font-size: 0.72rem;
    font-weight: bold;
    color: #66fcf1;
    border-bottom: 1px solid #354656;
    padding-bottom: 3px;
    margin-bottom: 4px;
    text-align: center;
}
#inventoryList {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.inv-section-title {
    font-size: 0.62rem;
    color: #bb86fc;
    font-weight: bold;
    margin-top: 2px;
}
.inv-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    padding: 3px 4px;
    background: #0b0c10;
    border-radius: 4px;
    border: 1px solid #1a232a;
}
/* カード＆ボタン */
.card {
    background: #1f2833;
    border: 1px solid #354656;
    border-radius: 6px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.card-title {
    font-size: 0.72rem;
    font-weight: bold;
    color: #66fcf1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.action-btn {
    background: #0b0c10;
    color: #ffffff;
    border: 1px solid #45a29e;
    padding: 6px 8px;
    width: 100%;
    font-size: 0.72rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    transition: background 0.1s;
}
.action-btn:active {
    background: #45a29e;
    color: #000;
}
.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-tag {
    background: #1f2833;
    color: #66fcf1;
    border: 1px solid #45a29e;
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: normal;
}
.btn-craft {
    border-color: #bb86fc;
}
.btn-craft .btn-tag {
    border-color: #bb86fc;
    color: #bb86fc;
}
.btn-shop {
    border-color: #ffb74d;
}
.btn-shop .btn-tag {
    border-color: #ffb74d;
    color: #ffb74d;
}
.btn-dungeon {
    border-color: #4fc3f7;
}
.btn-dungeon .btn-tag {
    border-color: #4fc3f7;
    color: #4fc3f7;
}
/* タブ切り替えボタン */
.tab-nav {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.tab-btn {
    flex: 1;
    background: #1f2833;
    color: #c5c6c7;
    border: 1px solid #354656;
    padding: 7px 0;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.tab-btn.active {
    background: #45a29e;
    color: #0b0c10;
    border-color: #66fcf1;
    box-shadow: 0 0 8px rgba(102, 252, 241, 0.4);
}
/* ログ領域（視認性改善） */
.log-card {
    max-height: 130px;
    height: auto;
    background: #141a21;
    border: 1px solid #354656;
    border-radius: 8px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}
.log-header {
    font-size: 0.65rem;
    font-weight: bold;
    color: #66fcf1;
    border-bottom: 1px solid #23313d;
    padding-bottom: 3px;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}
#log {
    flex: 1;
    font-size: 0.72rem;
    color: #d1d5db;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.log-line {
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(11, 12, 16, 0.6);
    line-height: 1.3;
    border-left: 3px solid #45a29e;
    word-break: break-all;
}
.log-day {
    color: #8899a6;
    font-size: 0.62rem;
    font-weight: bold;
    margin-right: 5px;
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 4px;
    border-radius: 3px;
}
.log-good {
    color: #66fcf1;
    border-left-color: #66fcf1;
    background: rgba(102, 252, 241, 0.08);
}
.log-bad {
    color: #ff6b6b;
    border-left-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.08);
}
.log-rare {
    color: #e0b0ff;
    border-left-color: #bb86fc;
    background: rgba(187, 134, 252, 0.12);
    font-weight: bold;
}
.log-battle {
    color: #ffd166;
    border-left-color: #ffb74d;
    background: rgba(255, 183, 77, 0.08);
}
/* モーダル */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 12px;
}
.modal-overlay.hidden {
    display: none;
}
.modal-content {
    background: #1f2833;
    border: 2px solid #45a29e;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 0 20px rgba(102, 252, 241, 0.3);
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.form-label {
    font-size: 0.72rem;
    color: #66fcf1;
    font-weight: bold;
}
.form-input, .form-select {
    padding: 8px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid #45a29e;
    background: #0b0c10;
    color: #ffffff;
    outline: none;
}
.battle-header {
    text-align: center;
    font-size: 0.9rem;
    font-weight: bold;
    color: #66fcf1;
    border-bottom: 1px solid #354656;
    padding-bottom: 6px;
}
.battle-stage {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0b0c10;
    border-radius: 8px;
    padding: 10px;
}
.unit-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.enemy-box {
    text-align: left;
}
.hero-box {
    text-align: right;
}
.unit-name {
    font-size: 0.75rem;
    font-weight: bold;
    color: #ffffff;
}
.vs-badge {
    font-size: 0.8rem;
    font-weight: bold;
    color: #ff6b6b;
    margin: 0 6px;
}
.hp-bar-outer {
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}
.hp-bar-inner {
    height: 100%;
    background: #4ecc6f;
    width: 100%;
    transition: width 0.3s;
}
.hp-text {
    font-size: 0.65rem;
    color: #c5c6c7;
}
.battle-log-area {
    height: 100px;
    background: #0b0c10;
    border: 1px solid #354656;
    border-radius: 6px;
    padding: 6px;
    font-size: 0.7rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.command-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}
.cmd-btn {
    padding: 8px 4px;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 6px;
    border: 1px solid #45a29e;
    background: #0b0c10;
    color: #ffffff;
    cursor: pointer;
}
.cmd-btn:active {
    opacity: 0.7;
}
.btn-attack {
    border-color: #ff6b6b;
    color: #ff6b6b;
}
.btn-skill {
    border-color: #bb86fc;
    color: #bb86fc;
}
.btn-heal {
    border-color: #4ecc6f;
    color: #4ecc6f;
}
.btn-run {
    border-color: #ffb74d;
    color: #ffb74d;
}
.loot-box {
    background: #0b0c10;
    border: 1px solid #354656;
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.loot-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #66fcf1;
}
/* hero-info-card 用追加スタイル */
.lvl-badge {
    background: #ffb74d;
    color: #000;
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.65rem;
    margin-left: 3px;
}