html, body {
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    width: 100vw;
    min-width: 100vw;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
    touch-action: manipulation;
}
body {
    display: flex;
    flex-direction: column;
    justify-content: stretch;
    align-items: stretch;
    background: #111;
    color: #ffe900;
    font-family: 'Press Start 2P', 'MS Gothic', monospace, sans-serif;
    font-size: 16px;
    image-rendering: pixelated;
    letter-spacing: 0.05em;
}
#root, .main-layout {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    height: 100%;
    box-sizing: border-box;
}
header, footer {
    background: #222;
    border-bottom: 8px solid #ffe900;
    border-top: 8px solid #ffe900;
    text-align: center;
    font-size: 1.2em;
    padding: 0.5em 0;
    letter-spacing: 0.15em;
}
.topbar, .statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2em;
    max-width: 1000px;
    margin: 0 auto;
}
.topbar {
    font-size: 1.4em;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000, 0 0 10px #ffe90077;
}
.official-link {
    background: #ffe900;
    color: #1a1a1a;
    border: 4px solid #444;
    border-radius: 0;
    font-weight: bold;
    padding: 0.2em 1.5em;
    text-decoration: none;
    font-family: inherit;
    font-size: 1em;
    box-shadow: 2px 2px 0 #000;
    display: inline-block;
}
.official-link:hover, .official-link:focus {
    background: #222;
    color: #ffe900;
    border-color: #ffe900;
}
.statusbar {
    font-size: 1em;
    background: #191919;
    border-top: 4px solid #ffe900;
    border-bottom: 4px solid #ffe900;
    padding: .5em 1em;
    gap: 3em;
}
.stat {
    display: flex;
    align-items: center;
    font-weight: bold;
    border: 2px solid #ffe900;
    background: #222;
    padding: 0.3em 1em;
    margin: 0 0.3em;
    border-radius: 0;
    box-shadow: 2px 2px 0 #000;
}
.bar-outer {
    width: 100px;
    height: 18px;
    background: #111;
    border: 2px solid #ffe900;
    border-radius: 0;
    margin-left: 0.5em;
    display: inline-block;
}
.bar-inner {
    height: 100%;
    background: #ffe900;
    border-radius: 0;
}
.main-layout {
    display: flex;
    gap: 1em;
    max-width: 1100px;
    margin: 2em auto;
    min-height: 0;
    padding: 0 1em;
    flex: 1 1 0;
    height: 100%;
    box-sizing: border-box;
}
.leftbar, .rightbar {
    flex: 0 0 220px;
    max-width: 220px;
    min-width: 0;
}
.card {
    background: #232323;
    border: 5px solid #ffe900;
    border-radius: 0;
    box-shadow: 4px 4px 0 #000;
    padding: 1em;
    margin-bottom: 1em;
    font-family: inherit;
}
.player-header {
    display: flex;
    align-items: center;
    gap: 1em;
    margin-bottom: .5em;
}
.player-name {
    font-size: 1.1em;
    font-weight: bold;
    color: #ffe900;
    background: #222;
    padding: 0.15em 0.7em;
    border: 2px solid #ffe900;
}
.level-badge {
    background: #ffe900;
    color: #111;
    border: 2px solid #222;
    padding: 0.13em 0.7em;
    font-weight: bold;
    font-size: 1em;
}
.name-edit-btn {
    background: #ffe900;
    color: #111;
    border: 2px solid #222;
    font-size: 1em;
    font-family: inherit;
    padding: 0.13em 0.8em;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 2px 2px 0 #000;
}
.name-edit-btn:active, .name-edit-btn.pressed {
    background: #222;
    color: #ffe900;
    border-color: #ffe900;
}
.player-stats {
    display: flex;
    gap: 1em;
    margin-top: 0.5em;
}
.stat-block {
    background: #111;
    border: 2px solid #ffe900;
    color: #ffe900;
    font-weight: bold;
    padding: 0.3em 1em;
    font-size: 1em;
    border-radius: 0;
    box-shadow: 2px 2px 0 #000;
}
#actions h2 {
    margin-top: 0;
    font-size: 1.1em;
    letter-spacing: 0.08em;
}
#actions .actions-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-gap: 0.5em;
    margin-top: .2em;
}
#actions button {
    background: #ffe900;
    color: #1a1a1a;
    border: 3px solid #222;
    font-weight: bold;
    border-radius: 0;
    font-family: inherit;
    font-size: 1.1em;
    padding: 1em 0;
    box-shadow: 2px 2px 0 #000;
    cursor: pointer;
    margin-bottom: .12em;
    transition: background 0.1s, color 0.1s, border 0.1s;
}
#actions button:active, #actions button.pressed {
    background: #222;
    color: #ffe900;
    border-color: #ffe900;
}
#actions button small {
    display: block;
    color: #1a1a1a;
    font-size: 0.9em;
    margin-top: 0.13em;
}
footer {
    font-size: 1em;
    color: #ffe900;
    padding: 1.5em 0 1em;
    border-top: 8px solid #ffe900;
    background: #222;
}
.save-autosave button {
    background: #ffe900;
    color: #1a1a1a;
    border: 3px solid #222;
    font-family: inherit;
    font-weight: bold;
    border-radius: 0;
    padding: 0.2em 1em;
    cursor: pointer;
    box-shadow: 2px 2px 0 #000;
}
.save-autosave button.pressed, .save-autosave button:active {
    background: #222;
    color: #ffe900;
    border-color: #ffe900;
}
.save-autosave button:hover, .save-autosave button:focus {
    background: #ffe900cc;
    color: #1a1a1a;
}
#saveMsg, .autosave-msg {
    color: #ffe900;
    font-weight: bold;
}
#effect-area {
    min-height: 90px;
    width: 100%;
    margin: 1.5em auto 0 auto;
    text-align: center;
    position: relative;
    pointer-events: none;
}
.effect-msg {
    display: inline-block;
    background: #ffe900;
    color: #111;
    font-family: 'Press Start 2P', 'MS Gothic', monospace;
    font-size: 1.25em;
    border: 4px solid #222;
    border-radius: 0;
    box-shadow: 4px 4px 0 #000;
    padding: 1.2em 2.1em;
    margin: 0.4em auto;
    letter-spacing: 0.04em;
    min-width: 200px;
    max-width: 90vw;
    word-break: break-all;
    opacity: 0;
    transform: scale(0.95) translateY(20px);
    transition: opacity 0.22s, transform 0.22s;
}
.show-anim .effect-msg {
    opacity: 1;
    transform: scale(1) translateY(0);
}
.effect-type-success {
    background: #ffe900;
    color: #111;
    border-color: #08ff5a;
}
.effect-type-warn {
    background: #111;
    color: #ffe900;
    border-color: #ff0000;
}
.effect-type-info {
    background: #ffe900;
    color: #111;
    border-color: #222;
}
@media (max-width: 900px) {
    .main-layout { flex-direction: column; }
    .leftbar, .rightbar, main { max-width: 100vw; }
    .player-stats { flex-direction: column; }
    #effect-area .effect-msg { font-size: 1em; min-width: 120px; padding: 0.8em 1.2em;}
}