.game-panel {
    --gold: #e7c482;
    --paper: #faf2db;
    --ink: #29291e;
    --faint-ink: #5e5947;
    --line: #c8b68b;
    --pine: #233833;
    --brass: #bea165;
    color-scheme: light;
    width: min(890px, calc(100vw - 30px));
    max-height: calc(100dvh - 30px);
    margin: auto;
    padding: clamp(12px, 2.2vw, 24px);
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #a08a62 #22352d;
    color: #f8edcf;
    background: radial-gradient(ellipse at 15% 0%, #374c3f, transparent 62%), #192824;
    border: 1px solid #a68d61;
    border-radius: 17px 5px 17px 5px;
    box-shadow: 0 24px 75px #070c08a9, inset 0 0 0 4px #17241e;
    font: 14px/1.35 'Segoe UI', system-ui, sans-serif;
}
.game-panel::backdrop { background: #1521179c; backdrop-filter: blur(4px); }
.game-panel [hidden] { display: none !important; }
.panel-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 0 13px;
    margin-bottom: 16px;
    border-bottom: 1px solid #a58b5966;
}
.game-panel h2 { font: bold clamp(27px, 4vw, 43px)/1 Georgia, serif; letter-spacing: -.025em; color: #ffedc4; }
.game-panel h3 { font: 650 17px/1.2 Georgia, serif; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.game-panel button, .game-panel input {
    font: inherit;
    color: inherit;
    border: 1px solid transparent;
    border-radius: 5px;
}
.game-panel button {
    min-height: 32px;
    cursor: pointer;
    padding: 5px 9px;
    background: #f5e8c61a;
    border-color: #c6ad7373;
}
.game-panel button:hover:not(:disabled) { filter: brightness(1.13); }
.game-panel :is(button, input):focus-visible { outline: 2px solid #db9f46; outline-offset: 2px; }
.game-panel button:disabled { opacity: .53; cursor: default; }
.game-panel button.panel-primary {
    color: #201b13;
    background: linear-gradient(140deg, #f3d49a, #dcb575);
    border-color: #a97b43;
    font-weight: 700;
}
.game-panel button.panel-quiet { font-size: 12px; color: var(--faint-ink); min-height: 27px; }
.game-panel kbd, .keycap {
    font: 600 10px/1 ui-monospace, monospace;
    border: 1px solid currentColor;
    border-radius: 3px;
    padding: 2px 3px;
    opacity: .76;
}
.panel-actions kbd { margin-left: 3px; }
.inventory-layout, .craft-layout { display: grid; grid-template-columns: 195px minmax(0, 1fr); gap: 14px; align-items: start; }
.craft-layout { grid-template-columns: minmax(190px, .64fr) minmax(0, 1fr); }
.inventory-modes, .craft-book {
    padding: 11px;
    border: 1px solid #b79b695c;
    border-radius: 8px;
    background: #111f1b74;
}
.inventory-modes h3, .craft-book h3 { color: var(--gold); padding: 1px 2px 9px; }
#modes-list, .craft-recipes { display: grid; gap: 6px; }
.game-panel .mode-entry, .game-panel .craft-recipe {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px;
    text-align: left;
    background: #2a3b32;
    border-color: #6f694f;
}
.game-panel :is(.mode-entry[aria-current="true"], .craft-recipe[aria-pressed="true"]) {
    background: #455441;
    border-color: var(--brass);
    box-shadow: inset 2px 0 var(--gold);
}
.mode-symbol { flex: none; width: 22px; text-align: center; }
.mode-copy, .recipe-copy { display: grid; gap: 2px; }
.mode-name, .recipe-name { font-weight: 650; }
.mode-detail, .recipe-detail { color: #ded3b7; font-size: 11px; line-height: 1.28; }
.recipe-detail[data-ready="true"] { color: #c4db9f; }
.inventory-content, .craft-workspace {
    padding: clamp(10px, 2vw, 17px);
    min-width: 0;
    color: var(--ink);
    background: radial-gradient(at 12% 0%, #fff8e6, transparent 75%), var(--paper);
    border: 1px solid #c1aa7d;
    border-radius: 8px;
    box-shadow: inset 0 0 0 2px #ebe0c1;
}
.section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.game-panel #inventory-search {
    width: min(190px, 100%);
    padding: 6px 9px;
    color: var(--ink);
    border-color: #b1a17d;
    background: #fffdf0;
    user-select: text;
}
.game-panel #inventory-search::placeholder { color: #726a57; }
#inventory-filters { display: flex; flex-wrap: wrap; gap: 5px; margin: 9px 0; }
.game-panel .panel-tab {
    min-height: 26px;
    padding: 3px 9px;
    color: #444333;
    background: #f8edcf;
    border-color: #b7aa86;
    font-size: 12px;
}
.game-panel .panel-tab[aria-pressed="true"] { background: var(--pine); color: #ffefcf; border-color: #3e5144; }
#inventory-grid, #oneblock-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
#oneblock-grid { margin-top: 12px; }
.game-panel .inventory-card {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 7px;
    padding: 5px;
    text-align: left;
    background: #f8edce;
    border-color: #c4b18a;
    min-height: 44px;
    line-height: 1.15;
}
.game-panel :is(.inventory-card, .quick-slot, .craft-ingredient, .craft-tools button)[aria-pressed="true"] {
    background: #e6eacc;
    border-color: #6f8153;
    box-shadow: inset 0 0 0 1px #71825a62;
}
.item-art {
    display: inline-block;
    flex: none;
    width: var(--icon-size, 29px);
    height: var(--icon-size, 29px);
    background-repeat: no-repeat;
    background-color: #7b76531c;
    border-radius: 4px;
}
.item-art:not(.has-art) { box-shadow: inset 0 0 0 1px #8b826641; }
.inventory-stack .item-art { --icon-size: 23px; }
.stack-count { margin-left: auto; font-size: 12px; color: #3b5935; }
.inventory-assignment { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 9px; }
#inventory-quickbar { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; margin-top: 7px; }
.game-panel .quick-slot {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 39px;
    padding: 4px;
    border-color: #c4b18a;
    background: #f4e8ca;
}
.quick-slot .keycap {
    position: absolute;
    top: 2px;
    left: 2px;
    border: 0;
    border-radius: 2px;
    color: #fff4cf;
    background: #283229;
    opacity: 1;
}
.quick-slot .item-art { --icon-size: min(25px, 4.3vw); }
#inventory-hint, #inventory-empty, .inventory-note { margin-top: 7px; color: var(--faint-ink); }
#inventory-hint { min-height: 1.35em; font-size: 12px; }

.craft-board {
    display: grid;
    grid-template-columns: max-content 24px minmax(68px, 1fr);
    align-items: center;
    gap: 10px;
    padding: clamp(8px, 2vw, 16px);
    margin: 7px 0 0;
    background: linear-gradient(145deg, #e7d9b3, #f3e6c6);
    border: 1px solid #c8b386;
    border-radius: 6px;
}
.craft-cells {
    --cell: clamp(32px, 6vw, 48px);
    display: grid;
    grid-template-columns: repeat(var(--craft-size), var(--cell));
    gap: 4px;
}
.game-panel .craft-cell {
    display: grid;
    place-items: center;
    width: var(--cell);
    height: var(--cell);
    padding: 0;
    background: #fdf4dc;
    border-color: #ac946b;
    box-shadow: inset 0 1px 2px #79674829;
}
.game-panel .craft-cell[data-missing="true"] { background: #f8dfc3; border-color: #be755d; }
.craft-cell .item-art { --icon-size: clamp(24px, 4vw, 34px); }
.craft-preview .item-art { --icon-size: 41px; }
.craft-arrow { color: #795733; text-align: center; font: 25px Georgia, serif; }
.craft-output { display: grid; justify-items: center; text-align: center; gap: 4px; }
.craft-preview {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border: 1px solid #a38b5c;
    background: #fff7dc;
    border-radius: 6px;
}
.craft-output-name { font-size: 12px; font-weight: 650; line-height: 1.14; }
.craft-status { color: var(--faint-ink); min-height: 2.7em; padding-top: 7px; font-size: 12px; }
.craft-create-actions { display: flex; gap: 6px; margin: 5px 0 12px; }
.game-panel .craft-all, .game-panel .craft-ingredient, .game-panel .craft-tools button, .game-panel .craft-clear {
    background: #f8edce;
    border-color: #c3ad82;
}
.craft-inventory { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; margin-top: 6px; }
.game-panel .craft-ingredient, .game-panel .craft-tools button {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 6px;
    padding: 4px 6px;
    font-size: 12px;
}
.craft-ingredient .item-art, .craft-tools .item-art { --icon-size: 21px; }
.ingredient-amount { margin-left: auto; }
.craft-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding: 9px;
    color: var(--ink);
    background: #e7d8b0;
    border-radius: 6px;
}

.hotbar-slot .block-preview.has-art { background-repeat: no-repeat; }
#craft-hint {
    position: fixed;
    top: 43px;
    left: 16px;
    z-index: 3;
    max-width: calc(100vw - 32px);
    color: #fff2d3;
    background: #151c13d9;
    border: 1px solid #77815b78;
    border-radius: 3px;
    padding: 3px 8px;
    font: 12px/1.25 system-ui, sans-serif;
    pointer-events: none;
}
#craft-hint:empty { display: none; }

@media (max-width: 685px) {
    .inventory-layout, .craft-layout { grid-template-columns: 1fr; }
    .inventory-modes { grid-row: 2; }
    #modes-list, .craft-recipes { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
    .inventory-modes .mode-detail, .mode-symbol { display: none; }
    .mode-copy { overflow-wrap: anywhere; }
    .game-panel .craft-recipe { padding: 6px; }
    .craft-recipe .item-art { --icon-size: 22px; }
}
@media (max-width: 435px) {
    #inventory-grid, #oneblock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quick-slot .keycap { display: none; }
    .game-panel .quick-slot { padding: 0; min-height: 28px; }
    .craft-board { gap: 4px; }
    .panel-header { margin-bottom: 8px; }
}
