* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, "Malgun Gothic", sans-serif;
    background: #eef4f0;
    color: #17211b;
}

button,
input {
    font: inherit;
}

a {
    color: #216e46;
    font-weight: 700;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 24px;
    border: 1px solid #d9e5dc;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 16px 40px rgba(23, 33, 27, 0.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.brand-mark,
.pigeon-badge {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #216e46;
    color: #ffffff;
    font-size: 24px;
    font-weight: 800;
}

.brand h1 {
    margin: 0 0 4px;
    font-size: 24px;
}

.brand p {
    margin: 0;
    color: #607066;
    font-size: 14px;
}

.auth-form {
    display: grid;
    gap: 10px;
}

.auth-form label {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 700;
}

.auth-form input {
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid #c9d8cf;
    border-radius: 6px;
    font-size: 16px;
    background: #fbfdfb;
    color: #17211b;
}

.auth-form input:focus {
    outline: 2px solid #8ac9a5;
    border-color: #216e46;
}

.auth-form button {
    min-height: 48px;
    margin-top: 14px;
    border: 0;
    border-radius: 6px;
    background: #216e46;
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

.auth-form button:hover {
    background: #185437;
}

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

.alert-error {
    background: #fff0f0;
    border: 1px solid #f0c1c1;
    color: #9b2020;
}

.field-error {
    margin: -4px 0 4px;
    color: #9b2020;
    font-size: 13px;
}

.auth-link {
    margin: 18px 0 0;
    text-align: center;
    color: #607066;
    font-size: 14px;
}

.game-body {
    min-height: 100vh;
    overflow: hidden;
    background: #dfece5;
}

.game-shell {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto auto auto;
}

.game-hud {
    display: grid;
    gap: 10px;
    padding: 10px;
    background: #ffffff;
    border-bottom: 1px solid #cbd9d0;
    box-shadow: 0 6px 18px rgba(23, 33, 27, 0.08);
    z-index: 3;
}

.notice-strip {
    grid-column: 1 / -1;
    min-height: 30px;
    padding: 7px 10px;
    border-radius: 6px;
    background: #fff8d8;
    color: #60420b;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hud-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.hud-profile strong {
    display: block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
}

.hud-profile span {
    display: inline-block;
    margin-right: 6px;
    color: #607066;
    font-size: 13px;
}

.pigeon-badge {
    width: 42px;
    height: 42px;
    font-size: 20px;
    flex: 0 0 auto;
}

.hud-bars {
    display: grid;
    gap: 7px;
}

.status-row {
    display: grid;
    grid-template-columns: 36px 1fr 84px;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
}

.status-row b {
    text-align: right;
    color: #3c4c42;
    font-size: 11px;
}

.status-bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #d6e0da;
}

.status-bar i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #d94c43;
    transition: width 160ms ease;
}

.status-bar.exp i {
    background: #2d72c7;
}

.hud-currencies {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.hud-currencies div {
    min-width: 0;
    padding: 8px;
    border-radius: 6px;
    background: #f2f7f4;
}

.hud-currencies span {
    display: block;
    color: #607066;
    font-size: 11px;
}

.hud-currencies b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.field-wrap {
    position: relative;
    overflow: auto;
    background: #b9d4c0;
    touch-action: none;
}

.game-field {
    position: relative;
    width: 960px;
    height: 640px;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
        #8fc49a;
    background-size: 48px 48px;
}

.map-grid {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 24%, rgba(255, 255, 255, 0.22) 0 24px, transparent 25px),
        radial-gradient(circle at 72% 64%, rgba(65, 126, 82, 0.2) 0 34px, transparent 35px);
    pointer-events: none;
}

.players-layer,
.monsters-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.player {
    position: absolute;
    width: 48px;
    height: 58px;
    transform: translate(-24px, -44px);
    display: grid;
    justify-items: center;
    gap: 3px;
    pointer-events: none;
    transition: left 80ms linear, top 80ms linear;
}

.bird {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% 50% 45% 45%;
    border: 2px solid #245239;
    background: #f8fbf9;
    color: #245239;
    font-weight: 900;
    box-shadow: 0 8px 14px rgba(23, 33, 27, 0.18);
}

.my-player .bird {
    background: #ffffff;
    border-color: #17462e;
    color: #17462e;
}

.other-player .bird {
    background: #edf4ff;
    border-color: #2d5b9d;
    color: #2d5b9d;
}

.player small {
    max-width: 96px;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.88);
    color: #17211b;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.monster {
    position: absolute;
    width: 74px;
    min-height: 66px;
    transform: translate(-37px, -48px);
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #17211b;
    cursor: pointer;
    pointer-events: auto;
}

.monster-mark {
    width: 38px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #6b2730;
    border-radius: 45% 45% 50% 50%;
    background: #ffd8d2;
    color: #6b2730;
    font-weight: 900;
    box-shadow: 0 8px 14px rgba(23, 33, 27, 0.16);
}

.monster small {
    max-width: 112px;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.9);
    color: #24181a;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.monster i {
    width: 48px;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(107, 39, 48, 0.2);
}

.monster i b {
    display: block;
    height: 100%;
    background: #c94040;
}

.monster.is-target .monster-mark {
    outline: 3px solid rgba(255, 222, 90, 0.95);
    background: #fff1bd;
}

.battle-float {
    position: absolute;
    left: 50%;
    top: 42%;
    transform: translate(-50%, -50%);
    min-width: 90px;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(23, 33, 27, 0.82);
    color: #ffffff;
    font-size: 18px;
    font-weight: 900;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms ease, transform 140ms ease;
    z-index: 5;
}

.battle-float.is-visible {
    opacity: 1;
    transform: translate(-50%, -68%);
}

.mobile-controls {
    position: relative;
    min-height: 144px;
    padding: 10px 14px;
    background: #ffffff;
    border-top: 1px solid #cbd9d0;
}

.dpad,
.attack-button {
    position: absolute;
    width: 52px;
    height: 52px;
    border: 1px solid #b6c9bd;
    border-radius: 8px;
    background: #f7fbf8;
    color: #17211b;
    font-weight: 800;
    cursor: pointer;
    user-select: none;
}

.dpad:active {
    background: #dbeee2;
}

.dpad.up {
    left: 76px;
    top: 10px;
}

.dpad.left {
    left: 20px;
    top: 66px;
}

.dpad.right {
    left: 132px;
    top: 66px;
}

.dpad.down {
    left: 76px;
    top: 66px;
}

.attack-button {
    right: 20px;
    top: 38px;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: #f1f1f1;
    color: #8a8f8b;
    cursor: not-allowed;
}

.attack-button.is-ready {
    background: #d94c43;
    border-color: #b93630;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(217, 76, 67, 0.28);
}

.battle-log {
    min-height: 34px;
    padding: 8px 12px;
    border-top: 1px solid #d7e2db;
    background: #fbfdfb;
    color: #34443a;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-menu {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1px;
    background: #c7d5cc;
    border-top: 1px solid #bac8bf;
    padding-bottom: env(safe-area-inset-bottom);
}

.game-menu button {
    position: relative;
    min-height: 44px;
    border: 0;
    background: #ffffff;
    color: #22382b;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.game-menu button:active {
    background: #edf6f0;
}

.menu-badge {
    position: absolute;
    top: 4px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border-radius: 999px;
    background: #d94c43;
    color: #ffffff;
    font-size: 10px;
    font-weight: 900;
}

.menu-badge.is-visible {
    display: inline-flex;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    background: rgba(13, 22, 17, 0.48);
    z-index: 20;
}

.modal-backdrop.is-open {
    display: flex;
}

.modal-panel {
    width: 100%;
    max-width: 520px;
    max-height: min(86vh, 720px);
    overflow: auto;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(13, 22, 17, 0.28);
}

.modal-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid #dbe6df;
    background: #ffffff;
    z-index: 1;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #b6c9bd;
    border-radius: 6px;
    background: #f7fbf8;
    color: #17211b;
    font-weight: 800;
    cursor: pointer;
}

.upgrade-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 16px 16px 8px;
}

.upgrade-card {
    min-height: 86px;
    padding: 10px;
    border: 1px solid #c9d8cf;
    border-radius: 8px;
    background: #f7fbf8;
    color: #17211b;
    text-align: left;
    cursor: pointer;
}

.upgrade-card.is-selected {
    border-color: #216e46;
    background: #e8f5ed;
    box-shadow: inset 0 0 0 1px #216e46;
}

.upgrade-card strong,
.upgrade-card span,
.upgrade-card small {
    display: block;
}

.upgrade-card strong {
    margin-bottom: 8px;
    font-size: 15px;
}

.upgrade-card span {
    color: #216e46;
    font-size: 13px;
    font-weight: 800;
}

.upgrade-card small {
    margin-top: 4px;
    color: #607066;
    font-size: 12px;
}

.upgrade-options {
    display: grid;
    gap: 8px;
    padding: 8px 16px;
}

.upgrade-options label {
    font-size: 13px;
    font-weight: 800;
    color: #34443a;
}

.upgrade-options select {
    width: 100%;
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid #c9d8cf;
    border-radius: 6px;
    background: #fbfdfb;
    color: #17211b;
}

.upgrade-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 16px;
}

.upgrade-summary span {
    min-width: 0;
    padding: 9px;
    border-radius: 6px;
    background: #f2f7f4;
    color: #607066;
    font-size: 11px;
}

.upgrade-summary b {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #17211b;
    font-size: 14px;
}

.upgrade-result {
    min-height: 40px;
    margin: 8px 16px;
    padding: 10px;
    border-radius: 6px;
    background: #f5f7f6;
    color: #34443a;
    font-size: 13px;
    font-weight: 800;
}

.upgrade-result.is-success {
    background: #e8f5ed;
    color: #185437;
}

.upgrade-result.is-fail {
    background: #fff0f0;
    color: #9b2020;
}

.upgrade-submit {
    width: calc(100% - 32px);
    min-height: 48px;
    margin: 0 16px 16px;
    border: 0;
    border-radius: 6px;
    background: #216e46;
    color: #ffffff;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
}

.upgrade-submit:disabled {
    background: #9aaaa0;
    cursor: wait;
}

.inventory-panel {
    max-width: 680px;
}

.inventory-result {
    min-height: 40px;
    margin: 16px 16px 8px;
    padding: 10px;
    border-radius: 6px;
    background: #f5f7f6;
    color: #34443a;
    font-size: 13px;
    font-weight: 800;
}

.inventory-result.is-success {
    background: #e8f5ed;
    color: #185437;
}

.inventory-result.is-fail {
    background: #fff0f0;
    color: #9b2020;
}

.inventory-list {
    display: grid;
    gap: 8px;
    padding: 8px 16px 16px;
}

.inventory-empty {
    padding: 28px 12px;
    border: 1px dashed #c9d8cf;
    border-radius: 8px;
    color: #607066;
    text-align: center;
    font-weight: 800;
}

.inventory-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 82px;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid #d8e2dc;
    border-left-width: 5px;
    border-radius: 8px;
    background: #ffffff;
}

.item-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eef4f0;
    color: #17211b;
    font-size: 14px;
    font-weight: 900;
}

.item-main {
    min-width: 0;
}

.item-main strong,
.item-main span,
.item-main p {
    display: block;
}

.item-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
}

.item-main span {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 900;
}

.item-main p {
    margin: 4px 0 0;
    color: #607066;
    font-size: 12px;
    line-height: 1.35;
}

.item-side {
    display: grid;
    gap: 6px;
    justify-items: stretch;
}

.item-side b {
    text-align: center;
    font-size: 13px;
}

.item-side button {
    min-height: 34px;
    border: 0;
    border-radius: 6px;
    background: #216e46;
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.item-side button:disabled {
    background: #d8dedb;
    color: #6d7670;
    cursor: default;
}

.rarity-normal {
    border-left-color: #9aa6a0;
}

.rarity-normal .item-main span {
    color: #68746d;
}

.rarity-rare {
    border-left-color: #2d72c7;
}

.rarity-rare .item-main span {
    color: #2d72c7;
}

.rarity-epic {
    border-left-color: #8b4fd6;
}

.rarity-epic .item-main span {
    color: #8b4fd6;
}

.rarity-legendary {
    border-left-color: #d78a1f;
}

.rarity-legendary .item-main span {
    color: #b46d0f;
}

.rarity-ancient {
    border-left-color: #c94040;
}

.rarity-ancient .item-main span {
    color: #c94040;
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-action {
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: #216e46;
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
}

.mailbox-panel {
    max-width: 860px;
}

.mailbox-result {
    min-height: 40px;
    margin: 16px 16px 8px;
    padding: 10px;
    border-radius: 6px;
    background: #f5f7f6;
    color: #34443a;
    font-size: 13px;
    font-weight: 800;
}

.mailbox-result.is-success {
    background: #e8f5ed;
    color: #185437;
}

.mailbox-result.is-fail {
    background: #fff0f0;
    color: #9b2020;
}

.mailbox-layout {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: 10px;
    padding: 8px 16px 16px;
}

.mailbox-list {
    display: grid;
    align-content: start;
    gap: 8px;
    max-height: 460px;
    overflow: auto;
}

.mail-row {
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px solid #d8e2dc;
    border-left: 5px solid #9aa6a0;
    border-radius: 8px;
    background: #ffffff;
    color: #17211b;
    text-align: left;
    cursor: pointer;
}

.mail-row.is-unread {
    border-left-color: #2d72c7;
    background: #f2f8ff;
}

.mail-row.is-claimed {
    opacity: 0.72;
}

.mail-row.is-expired {
    border-left-color: #9b2020;
    opacity: 0.64;
}

.mail-row strong,
.mail-row span,
.mail-row small,
.mail-row em {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-row strong {
    font-size: 14px;
}

.mail-row span,
.mail-row small {
    color: #607066;
    font-size: 12px;
}

.mail-row em {
    color: #216e46;
    font-size: 12px;
    font-style: normal;
    font-weight: 900;
}

.mail-empty {
    padding: 28px 12px;
    border: 1px dashed #c9d8cf;
    border-radius: 8px;
    color: #607066;
    text-align: center;
    font-weight: 800;
}

.mailbox-detail {
    min-height: 260px;
    padding: 14px;
    border: 1px solid #d8e2dc;
    border-radius: 8px;
    background: #ffffff;
}

.mailbox-detail h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.mail-meta {
    margin: 0 0 12px;
    color: #607066;
    font-size: 12px;
    font-weight: 800;
}

.mail-content {
    margin: 0 0 14px;
    color: #25362c;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.mail-rewards {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.mail-rewards span {
    padding: 6px 8px;
    border-radius: 6px;
    background: #f2f7f4;
    color: #17211b;
    font-size: 12px;
    font-weight: 900;
}

.rarity-text-rare {
    color: #2d72c7;
}

.rarity-text-epic {
    color: #8b4fd6;
}

.rarity-text-legendary {
    color: #b46d0f;
}

.rarity-text-ancient {
    color: #c94040;
}

.mail-claim {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    background: #216e46;
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
}

.mail-claim:disabled {
    background: #d8dedb;
    color: #6d7670;
    cursor: default;
}

.ranking-panel,
.chat-panel {
    max-width: 760px;
}

.ranking-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 12px 16px 8px;
}

.ranking-tabs button {
    min-height: 38px;
    border: 1px solid #c9d8cf;
    border-radius: 6px;
    background: #f7fbf8;
    font-weight: 900;
    cursor: pointer;
}

.ranking-tabs button.is-selected {
    background: #216e46;
    color: #ffffff;
}

.ranking-my {
    margin: 0 16px 8px;
    padding: 10px;
    border-radius: 6px;
    background: #f2f7f4;
    font-weight: 900;
}

.ranking-list {
    display: grid;
    gap: 6px;
    padding: 8px 16px 16px;
    max-height: 520px;
    overflow: auto;
}

.ranking-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 110px;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border: 1px solid #d8e2dc;
    border-radius: 8px;
    background: #ffffff;
}

.ranking-row b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #216e46;
    color: #ffffff;
}

.ranking-row strong,
.ranking-row span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-row span {
    grid-column: 2;
    color: #607066;
    font-size: 12px;
}

.ranking-row em {
    grid-row: 1 / span 2;
    grid-column: 3;
    text-align: right;
    font-style: normal;
    font-weight: 900;
}

.chat-list {
    display: grid;
    gap: 6px;
    height: 420px;
    overflow: auto;
    padding: 14px 16px;
    background: #f7fbf8;
}

.chat-row {
    display: grid;
    gap: 3px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #d8e2dc;
}

.chat-row b {
    color: #216e46;
    font-size: 13px;
}

.chat-row span {
    color: #17211b;
    font-size: 14px;
}

.chat-row small {
    color: #607066;
    font-size: 11px;
}

.chat-form {
    display: grid;
    grid-template-columns: 1fr 72px;
    gap: 8px;
    padding: 12px 16px 4px;
}

.chat-form input {
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid #c9d8cf;
    border-radius: 6px;
}

.chat-form button,
.small-danger {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    background: #216e46;
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
}

.chat-result {
    margin: 0 16px 16px;
    color: #607066;
    font-size: 12px;
    font-weight: 800;
}

.quest-panel {
    max-width: 760px;
}

.quest-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 12px 16px 8px;
}

.quest-tabs button {
    min-height: 38px;
    border: 1px solid #c9d8cf;
    border-radius: 6px;
    background: #f7fbf8;
    font-weight: 900;
    cursor: pointer;
}

.quest-tabs button.is-selected {
    background: #216e46;
    color: #ffffff;
}

.quest-result {
    margin: 0 16px 8px;
    padding: 10px;
    border-radius: 6px;
    background: #f2f7f4;
    color: #34443a;
    font-size: 13px;
    font-weight: 900;
}

.quest-list {
    display: grid;
    gap: 8px;
    padding: 8px 16px 16px;
    max-height: 520px;
    overflow: auto;
}

.quest-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 140px 92px;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid #d8e2dc;
    border-left: 5px solid #9aa6a0;
    border-radius: 8px;
    background: #ffffff;
}

.quest-item.is-complete {
    border-left-color: #216e46;
    background: #f2fbf5;
}

.quest-item.is-rewarded {
    opacity: 0.68;
}

.quest-item strong,
.quest-item p,
.quest-item small {
    display: block;
    min-width: 0;
}

.quest-item strong {
    font-size: 15px;
}

.quest-item p {
    margin: 4px 0;
    color: #34443a;
    font-size: 13px;
}

.quest-item small {
    color: #607066;
    font-size: 12px;
}

.quest-progress {
    display: grid;
    gap: 5px;
}

.quest-progress span {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #d6e0da;
}

.quest-progress b {
    display: block;
    width: 0;
    height: 100%;
    background: #216e46;
}

.quest-progress em {
    color: #34443a;
    font-size: 12px;
    font-style: normal;
    font-weight: 900;
    text-align: right;
}

.quest-item button {
    min-height: 38px;
    border: 0;
    border-radius: 6px;
    background: #216e46;
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
}

.quest-item button:disabled {
    background: #d8dedb;
    color: #6d7670;
    cursor: default;
}

.quest-empty {
    padding: 28px 12px;
    border: 1px dashed #c9d8cf;
    border-radius: 8px;
    color: #607066;
    text-align: center;
    font-weight: 800;
}

.attendance-panel,
.shop-panel {
    max-width: 680px;
}

.attendance-box {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.attendance-box strong {
    font-size: 24px;
}

.attendance-box p,
.shop-result {
    margin: 0;
    padding: 10px;
    border-radius: 6px;
    background: #f2f7f4;
    color: #34443a;
    font-weight: 900;
}

.attendance-rewards {
    display: grid;
    gap: 8px;
}

.attendance-rewards span {
    padding: 10px;
    border: 1px solid #d8e2dc;
    border-radius: 8px;
    background: #ffffff;
    font-weight: 800;
}

.attendance-box button {
    min-height: 46px;
    border: 0;
    border-radius: 6px;
    background: #216e46;
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
}

.attendance-box button:disabled {
    background: #d8dedb;
    color: #6d7670;
    cursor: default;
}

.shop-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 14px 16px 8px;
}

.shop-tabs button {
    min-height: 40px;
    border: 1px solid #c9d8cf;
    border-radius: 6px;
    background: #f7fbf8;
    font-weight: 900;
    cursor: pointer;
}

.shop-tabs button.is-selected {
    background: #216e46;
    color: #ffffff;
}

.shop-result {
    margin: 0 16px 8px;
}

.shop-list {
    display: grid;
    gap: 8px;
    padding: 8px 16px 16px;
    max-height: 520px;
    overflow: auto;
}

.shop-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid #d8e2dc;
    border-left-width: 5px;
    border-radius: 8px;
    background: #ffffff;
}

.shop-card strong,
.shop-card p,
.shop-card small {
    display: block;
}

.shop-card p {
    margin: 4px 0;
    color: #607066;
    font-size: 13px;
}

.shop-card small {
    color: #216e46;
    font-weight: 900;
}

.shop-card button {
    min-height: 38px;
    border: 0;
    border-radius: 6px;
    background: #216e46;
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
}

.dungeon-panel,
.boss-panel {
    max-width: 680px;
}

.content-result {
    margin: 16px 16px 8px;
    padding: 10px;
    border-radius: 6px;
    background: #f2f7f4;
    color: #34443a;
    font-weight: 900;
}

.content-list {
    display: grid;
    gap: 8px;
    padding: 8px 16px 16px;
}

.content-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 86px;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid #d8e2dc;
    border-left: 5px solid #216e46;
    border-radius: 8px;
    background: #ffffff;
}

.boss-card {
    border-left-color: #9b3b32;
}

.content-card strong,
.content-card p,
.content-card small {
    display: block;
}

.content-card p {
    margin: 5px 0;
    color: #607066;
    font-size: 13px;
}

.content-card small {
    color: #216e46;
    font-weight: 900;
}

.boss-card small {
    color: #9b3b32;
}

.content-card button {
    min-height: 38px;
    border: 0;
    border-radius: 6px;
    background: #216e46;
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
}

.boss-card button {
    background: #9b3b32;
}

.content-card button:disabled {
    background: #d8dedb;
    color: #6d7670;
    cursor: default;
}

.small-danger {
    min-height: 30px;
    background: #d94c43;
    font-size: 12px;
}

@media (min-width: 760px) {
    .game-shell {
        grid-template-rows: auto 1fr auto auto;
    }

    .game-hud {
        grid-template-columns: 240px 1fr 320px;
        align-items: center;
    }

    .mobile-controls {
        position: fixed;
        left: 20px;
        bottom: 64px;
        width: 210px;
        min-height: 134px;
        border: 1px solid #cbd9d0;
        border-radius: 8px;
        box-shadow: 0 12px 28px rgba(23, 33, 27, 0.16);
    }

    .field-wrap {
        display: flex;
        align-items: center;
        justify-content: center;
    }

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

    .modal-backdrop {
        align-items: center;
    }
}

@media (max-width: 420px) {
    .auth-card {
        padding: 20px;
    }

    .brand h1 {
        font-size: 22px;
    }

    .upgrade-summary {
        grid-template-columns: 1fr;
    }

    .inventory-item {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .item-side {
        grid-column: 1 / -1;
        grid-template-columns: 64px 1fr;
        align-items: center;
    }

    .mailbox-layout {
        grid-template-columns: 1fr;
    }

    .mailbox-list {
        max-height: 260px;
    }

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

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

    .quest-item {
        grid-template-columns: 1fr;
    }

    .quest-progress em {
        text-align: left;
    }

    .ranking-row {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .ranking-row em {
        grid-row: auto;
        grid-column: 2;
        text-align: left;
    }

    .modal-actions {
        gap: 6px;
    }

    .modal-action,
    .modal-close {
        padding: 0 9px;
        font-size: 12px;
    }
}

.admin-body {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    background: #f3f6f4;
}

.admin-sidebar {
    min-height: 100vh;
    padding: 18px;
    background: #17211b;
    color: #ffffff;
}

.admin-sidebar h1 {
    margin: 0 0 6px;
    font-size: 22px;
}

.admin-sidebar p {
    margin: 0 0 18px;
    color: #b9c8bf;
}

.admin-sidebar nav {
    display: grid;
    gap: 6px;
}

.admin-sidebar a {
    display: block;
    padding: 10px;
    border-radius: 6px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 800;
}

.admin-sidebar a:hover {
    background: #26382d;
}

.admin-sidebar a.is-active {
    background: #216e46;
}

.admin-main {
    min-width: 0;
    padding: 20px;
}

.admin-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.admin-top h2 {
    margin: 0;
    font-size: 24px;
}

.admin-grid.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.admin-grid.stats div,
.admin-panel,
.admin-form {
    border: 1px solid #d8e2dc;
    border-radius: 8px;
    background: #ffffff;
}

.admin-grid.stats div {
    padding: 14px;
}

.admin-grid.stats span {
    display: block;
    color: #607066;
    font-size: 12px;
    font-weight: 800;
}

.admin-grid.stats b {
    display: block;
    margin-top: 6px;
    font-size: 22px;
}

.admin-panel {
    margin-bottom: 16px;
    padding: 14px;
    overflow: auto;
}

.admin-panel h3 {
    margin: 0 0 10px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    font-size: 13px;
}

.admin-table th,
.admin-table td {
    padding: 9px;
    border-bottom: 1px solid #e2ebe5;
    text-align: left;
}

.admin-table th {
    background: #f2f7f4;
}

.admin-form {
    display: grid;
    gap: 10px;
    max-width: 640px;
    margin-bottom: 16px;
    padding: 14px;
}

.admin-form.inline {
    grid-template-columns: 1fr auto;
}

.admin-form.admin-search {
    max-width: none;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    align-items: end;
}

.admin-wide-form {
    max-width: none;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.admin-wide-form h3 {
    grid-column: 1 / -1;
    margin: 0;
}

.admin-form label {
    font-size: 13px;
    font-weight: 900;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #c9d8cf;
    border-radius: 6px;
    background: #fbfdfb;
}

.admin-form button {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    background: #216e46;
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
}

.admin-alert {
    max-width: 760px;
    margin: 0 0 12px;
    padding: 12px;
    border-radius: 6px;
    font-weight: 800;
}

.admin-alert.success {
    background: #e8f5ed;
    color: #185437;
}

.admin-alert.error {
    background: #fff0f0;
    color: #9b2020;
}

.muted {
    color: #607066;
}

.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 12px;
}

.admin-pagination a,
.admin-pagination span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid #c9d8cf;
    border-radius: 6px;
    background: #f7fbf8;
    color: #17211b;
    text-decoration: none;
    font-weight: 800;
}

@media (max-width: 760px) {
    .admin-body {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        min-height: auto;
    }

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

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

    .admin-form.admin-search,
    .admin-wide-form {
        grid-template-columns: 1fr;
    }
}

/* Step 13 game UX overhaul */
:root {
    --game-bg: #07111f;
    --game-panel: #0d1b2f;
    --game-panel-2: #13243c;
    --game-line: #27415f;
    --game-gold: #f7c948;
    --game-sky: #6fd3ff;
    --game-green: #9ef47a;
    --game-red: #ff6370;
    --game-text: #f5fbff;
    --game-muted: #99afc8;
}

.game-body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 18% 12%, rgba(111, 211, 255, 0.14), transparent 28%),
        linear-gradient(180deg, #07111f 0%, #0b1728 54%, #08111f 100%);
    color: var(--game-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow: hidden;
}

.game-shell {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
    width: min(100vw, 1180px);
    height: 100dvh;
    margin: 0 auto;
    background: rgba(7, 17, 31, 0.82);
    border-inline: 1px solid rgba(111, 211, 255, 0.12);
}

.game-hud {
    position: relative;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.6fr);
    gap: 8px;
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
    background: linear-gradient(180deg, rgba(15, 31, 52, 0.98), rgba(10, 22, 39, 0.94));
    border-bottom: 1px solid rgba(247, 201, 72, 0.24);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.notice-strip {
    grid-column: 1 / -1;
    min-height: 26px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    border: 1px solid rgba(247, 201, 72, 0.22);
    border-radius: 7px;
    background: rgba(247, 201, 72, 0.09);
    color: #ffe7a1;
    font-size: 12px;
    font-weight: 800;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.hud-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.pigeon-badge {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 2px solid rgba(247, 201, 72, 0.7);
    border-radius: 8px;
    background: linear-gradient(180deg, #f7c948, #db8d24);
    color: #152033;
    font-weight: 1000;
    box-shadow: 0 0 0 3px rgba(247, 201, 72, 0.12);
}

.hud-profile strong,
.hud-profile span {
    display: block;
    min-width: 0;
}

.hud-profile strong {
    max-width: 140px;
    overflow: hidden;
    color: #ffffff;
    font-size: 15px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.hud-profile span {
    color: var(--game-muted);
    font-size: 12px;
    font-weight: 800;
}

.hud-bars {
    display: grid;
    gap: 6px;
}

.status-row {
    display: grid;
    grid-template-columns: 34px minmax(90px, 1fr) 74px;
    align-items: center;
    gap: 7px;
    color: var(--game-muted);
    font-size: 11px;
    font-weight: 900;
}

.status-bar {
    height: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.36);
}

.status-bar i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff6370, #ff9a8b);
    transition: width 220ms ease;
}

.status-bar.exp i {
    background: linear-gradient(90deg, #6fd3ff, #9ef47a);
}

.status-row b {
    color: #ffffff;
    text-align: right;
    font-size: 10px;
}

.hud-currencies {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.hud-currencies div {
    min-width: 0;
    padding: 7px 8px;
    border: 1px solid rgba(111, 211, 255, 0.16);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.055);
}

.hud-currencies span {
    display: block;
    color: var(--game-muted);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.hud-currencies b {
    display: block;
    overflow: hidden;
    color: #ffffff;
    font-size: 13px;
    text-overflow: ellipsis;
}

.field-wrap {
    position: relative;
    min-height: 0;
    overflow: auto;
    background:
        linear-gradient(90deg, rgba(111, 211, 255, 0.06) 1px, transparent 1px),
        linear-gradient(0deg, rgba(111, 211, 255, 0.05) 1px, transparent 1px),
        #0b1728;
    background-size: 32px 32px;
    touch-action: none;
}

.target-panel {
    position: sticky;
    top: 8px;
    left: 8px;
    z-index: 4;
    width: min(280px, calc(100vw - 24px));
    margin: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(111, 211, 255, 0.24);
    border-radius: 8px;
    background: rgba(13, 27, 47, 0.9);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.target-panel strong,
.target-panel span,
.target-panel small {
    display: block;
}

.target-panel strong {
    color: #ffffff;
    font-size: 13px;
}

.target-panel span,
.target-panel small {
    color: var(--game-muted);
    font-size: 11px;
    font-weight: 800;
}

.target-panel.is-ready {
    border-color: rgba(158, 244, 122, 0.8);
}

.game-field {
    position: relative;
    min-width: 960px;
    min-height: 640px;
}

.map-grid {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 24%, rgba(158, 244, 122, 0.12), transparent 15%),
        radial-gradient(circle at 76% 68%, rgba(247, 201, 72, 0.12), transparent 14%);
}

.player,
.monster {
    position: absolute;
    transform: translate(-50%, -50%);
}

.player {
    width: 52px;
    display: grid;
    justify-items: center;
    gap: 2px;
    pointer-events: none;
}

.bird,
.monster-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    image-rendering: pixelated;
    border-radius: 7px;
    font-weight: 1000;
}

.my-player .bird {
    background: linear-gradient(180deg, #ffffff, #bfe8ff);
    color: #13243c;
    border: 2px solid var(--game-sky);
    box-shadow: 0 0 18px rgba(111, 211, 255, 0.55);
}

.other-player .bird {
    background: #263d5a;
    color: #d8eeff;
    border: 1px solid rgba(111, 211, 255, 0.4);
}

.player small,
.monster small {
    max-width: 120px;
    padding: 2px 5px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.48);
    color: #ffffff;
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
}

.monster {
    width: 86px;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.monster-mark {
    margin: 0 auto 3px;
    background: linear-gradient(180deg, #ff8a70, #a63145);
    color: #fff7f0;
    border: 2px solid rgba(255, 255, 255, 0.18);
}

.monster i {
    display: block;
    width: 58px;
    height: 6px;
    margin: 3px auto 0;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
}

.monster i b {
    display: block;
    height: 100%;
    background: var(--game-red);
}

.monster.is-target .monster-mark {
    outline: 3px solid rgba(247, 201, 72, 0.7);
    box-shadow: 0 0 22px rgba(247, 201, 72, 0.5);
}

.battle-float {
    position: absolute;
    left: 50%;
    top: 42%;
    transform: translate(-50%, -20px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    color: #ffffff;
    font-size: 24px;
    font-weight: 1000;
    text-shadow: 0 3px 0 #06101d, 0 0 18px rgba(247, 201, 72, 0.48);
    transition: opacity 160ms ease, transform 260ms ease;
    z-index: 6;
}

.battle-float.is-visible {
    opacity: 1;
    transform: translate(-50%, -56px) scale(1);
}

.battle-float.is-critical,
.battle-float.is-level {
    color: var(--game-gold);
}

.mobile-controls {
    position: relative;
    min-height: 126px;
    background: linear-gradient(180deg, rgba(12, 25, 43, 0.95), rgba(7, 17, 31, 0.98));
    border-top: 1px solid rgba(111, 211, 255, 0.16);
}

.dpad,
.attack-button {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 1000;
    touch-action: manipulation;
    user-select: none;
}

.dpad {
    width: 54px;
    height: 54px;
    border-radius: 8px;
    background: linear-gradient(180deg, #1b3353, #10223a);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}

.dpad.up { left: 76px; top: 8px; }
.dpad.left { left: 18px; top: 66px; }
.dpad.right { left: 134px; top: 66px; }
.dpad.down { left: 76px; top: 66px; }

.attack-button {
    right: 18px;
    top: 24px;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: #263146;
    color: #7f91a8;
}

.attack-button.is-ready {
    background: radial-gradient(circle at 34% 28%, #ffb07a, #db3654 65%);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 0 28px rgba(255, 99, 112, 0.35);
}

.battle-log {
    min-height: 38px;
    padding: 10px 12px;
    border-top: 1px solid rgba(111, 211, 255, 0.14);
    background: rgba(7, 17, 31, 0.96);
    color: #d9edff;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.battle-log.is-pulse {
    animation: logPulse 420ms ease;
}

@keyframes logPulse {
    0% { color: var(--game-gold); }
    100% { color: #d9edff; }
}

.game-menu {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1px;
    padding: 1px 1px calc(1px + env(safe-area-inset-bottom));
    background: rgba(111, 211, 255, 0.16);
}

.game-menu button {
    position: relative;
    min-height: 54px;
    display: grid;
    place-items: center;
    gap: 2px;
    border: 0;
    background: linear-gradient(180deg, #13243c, #0b1728);
    color: #d8eeff;
    font-size: 10px;
    font-weight: 900;
    cursor: pointer;
}

.game-menu button i {
    display: grid;
    place-items: center;
    width: 24px;
    height: 22px;
    border-radius: 6px;
    background: rgba(247, 201, 72, 0.12);
    color: var(--game-gold);
    font-style: normal;
    font-size: 14px;
}

.game-menu button:active {
    background: #1b3353;
}

.menu-badge {
    position: absolute;
    top: 4px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    display: none;
    place-items: center;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--game-red);
    color: #ffffff;
    font-size: 10px;
    font-style: normal;
    font-weight: 1000;
}

.menu-badge.is-visible {
    display: grid;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 14px;
    background: rgba(3, 8, 15, 0.72);
    z-index: 30;
}

.modal-backdrop.is-open {
    display: flex;
}

.modal-panel {
    width: min(720px, 100%);
    max-height: min(88dvh, 760px);
    overflow: auto;
    border: 1px solid rgba(111, 211, 255, 0.22);
    border-radius: 10px 10px 8px 8px;
    background: linear-gradient(180deg, #13243c, #0b1728);
    color: var(--game-text);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(11, 23, 40, 0.98);
    border-bottom: 1px solid rgba(111, 211, 255, 0.18);
}

.modal-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 18px;
}

.modal-close,
.modal-action,
.upgrade-submit,
.attendance-box button,
.shop-card button,
.content-card button,
.mail-claim,
.quest-item button,
.chat-form button {
    min-height: 40px;
    border: 0;
    border-radius: 7px;
    background: linear-gradient(180deg, #f7c948, #c9831d);
    color: #142033;
    font-weight: 1000;
    cursor: pointer;
}

.modal-close {
    padding: 0 12px;
    background: #1b3353;
    color: #d8eeff;
    border: 1px solid rgba(111, 211, 255, 0.2);
}

.upgrade-card,
.inventory-item,
.quest-item,
.mail-row,
.shop-card,
.content-card,
.ranking-row,
.chat-row,
.attendance-rewards span {
    border: 1px solid rgba(111, 211, 255, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--game-text);
}

.upgrade-card.is-selected,
.shop-tabs button.is-selected,
.quest-tabs button.is-selected,
.ranking-tabs button.is-selected {
    border-color: rgba(247, 201, 72, 0.75);
    background: rgba(247, 201, 72, 0.16);
    color: #fff2bd;
}

.upgrade-result,
.inventory-result,
.mailbox-result,
.quest-result,
.ranking-my,
.shop-result,
.content-result,
.chat-result,
.attendance-box p {
    margin: 12px 16px;
    padding: 10px;
    border: 1px solid rgba(111, 211, 255, 0.16);
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.22);
    color: #d8eeff;
    font-weight: 900;
}

.is-success {
    color: var(--game-green) !important;
}

.is-fail {
    color: var(--game-red) !important;
}

.rarity-normal { border-left-color: #b8c7d9; }
.rarity-rare { border-left-color: var(--game-sky); }
.rarity-epic { border-left-color: #b28cff; }
.rarity-legendary { border-left-color: var(--game-gold); }
.rarity-ancient { border-left-color: #ff8a70; }

.toast-stack {
    position: fixed;
    left: 50%;
    bottom: calc(74px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 60;
    display: grid;
    gap: 8px;
    width: min(420px, calc(100vw - 28px));
    pointer-events: none;
}

.game-toast {
    transform: translateY(10px);
    opacity: 0;
    padding: 10px 12px;
    border: 1px solid rgba(111, 211, 255, 0.24);
    border-radius: 8px;
    background: rgba(13, 27, 47, 0.96);
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    transition: opacity 180ms ease, transform 180ms ease;
}

.game-toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.game-toast.is-reward,
.game-toast.is-level {
    border-color: rgba(247, 201, 72, 0.55);
    color: #fff2bd;
}

.game-toast.is-error {
    border-color: rgba(255, 99, 112, 0.55);
    color: #ffd5da;
}

.global-loading {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: none;
    place-items: center;
    background: rgba(3, 8, 15, 0.68);
}

.global-loading.is-visible {
    display: grid;
}

.global-loading div {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 18px 22px;
    border: 1px solid rgba(111, 211, 255, 0.22);
    border-radius: 10px;
    background: #0d1b2f;
    color: #ffffff;
    font-weight: 1000;
}

.global-loading b {
    width: 34px;
    height: 34px;
    border: 4px solid rgba(111, 211, 255, 0.2);
    border-top-color: var(--game-gold);
    border-radius: 50%;
    animation: spin 900ms linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (min-width: 900px) {
    .game-shell {
        grid-template-columns: minmax(0, 1fr) 220px;
        grid-template-rows: auto minmax(0, 1fr) auto;
    }

    .game-hud {
        grid-column: 1 / -1;
        grid-template-columns: 260px minmax(260px, 1fr) 320px;
        align-items: center;
    }

    .notice-strip {
        grid-column: 1 / -1;
    }

    .hud-currencies {
        grid-column: auto;
    }

    .field-wrap {
        grid-column: 1;
    }

    .mobile-controls {
        grid-column: 2;
        grid-row: 2;
        min-height: auto;
    }

    .battle-log {
        grid-column: 1 / -1;
    }

    .game-menu {
        grid-column: 2;
        grid-row: 2;
        align-self: end;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: 360px;
        overflow: auto;
    }

    .modal-backdrop {
        align-items: center;
    }
}

@media (max-width: 430px) {
    .game-hud {
        grid-template-columns: 1fr;
    }

    .hud-currencies {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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