/* Packaging Workbench. Follows the store v2 frame: a left menu of big raised
   buttons with the current one marked by an accent edge, boxes with an
   uppercase header bar, Verdana body and Trebuchet headings. Dark by default. */

:root, :root[data-theme="dark"] {
  --bg: #121418;
  --page: #1a1d23;
  --panel: #20242b;
  --panel-2: #262b33;
  --head-a: #2e333c;
  --head-b: #252930;
  --line: #3a404b;
  --line-soft: #2e333c;
  --ink: #e4e6ea;
  --mute: #a4aab5;
  --faint: #7c8390;
  --link: #8fb0ff;
  --hot: #ff8a5c;
  --accent: #e53d10;
  --btn-a: #353b46;
  --btn-b: #2a2f38;
  --btn-ink: #c9d6ff;
  --input: #14171c;
  --ok: #6cc785;
  --ok-bg: #18301f;
  --warn: #e8bf5a;
  --warn-bg: #352c14;
  --bad: #ff7b7b;
  --bad-bg: #3a1a1c;
  --info-bg: #1b2740;
  --changed: #8fb0ff;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #bfbfbf;
  --page: #fff;
  --panel: #f8f8f8;
  --panel-2: #fff;
  --head-a: #f0f0f0;
  --head-b: #dedede;
  --line: #c0c0c0;
  --line-soft: #ddd;
  --ink: #333;
  --mute: #666;
  --faint: #999;
  --link: #2e5cbd;
  --hot: #e53d10;
  --accent: #e53d10;
  --btn-a: #f6f6f6;
  --btn-b: #dedede;
  --btn-ink: #2e5cbd;
  --input: #fff;
  --ok: #2f6f2f;
  --ok-bg: #eaf5ea;
  --warn: #7a5a00;
  --warn-bg: #fff6d6;
  --bad: #b3261e;
  --bad-bg: #fdecea;
  --info-bg: #eaf0fb;
  --changed: #2e5cbd;
  --shadow: none;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0 auto; max-width: 1180px; min-height: 100vh; background: var(--page); color: var(--ink); font: 14px/1.5 Verdana, Helvetica, Arial, sans-serif; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--hot); text-decoration: underline; }
code, .hexval { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12.5px; }
h1 { font: bold 24px/1.25 "Trebuchet MS", Arial, sans-serif; margin: 0 0 6px; }
.lede { color: var(--mute); margin: 0 0 14px; max-width: 70ch; }
.small, small { font-size: 12px; }
.faint { color: var(--faint); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: var(--page); padding: 6px 10px; z-index: 10; }
:focus-visible { outline: 2px solid var(--hot); outline-offset: 2px; }

/* Header */
.top { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 14px; font: bold 24px/1 "Trebuchet MS", Arial, sans-serif; color: var(--ink); letter-spacing: .01em; }
.brand .logo { display: block; width: auto; height: 40px; }
.brand .hi { color: var(--accent); }
.brand:hover { color: var(--ink); text-decoration: none; }
#file-notice { margin: 12px 16px 0; }
.tagline { color: var(--mute); font-size: 13px; }
.top #theme { margin-left: auto; }

/* Frame: menu column on the left, tool on the right */
.frame { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 0 16px; padding: 14px 16px 24px; align-items: start; }
.menu { list-style: none; margin: 0 0 12px; padding: 0; }
.menu li { margin: 0 0 6px; }
.menu a { display: block; padding: 9px 14px; font: bold 21px/1.25 Verdana, Helvetica, Arial, sans-serif; color: var(--btn-ink); background: linear-gradient(var(--btn-a), var(--btn-b)); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); }
.menu a:hover { color: var(--hot); text-decoration: none; background: var(--panel-2); }
.menu li.on a { background: var(--panel-2); color: var(--ink); border-left: 5px solid var(--accent); padding-left: 10px; }
main { min-width: 0; outline: none; }
main:focus, main:focus-visible { outline: none; }

/* Boxes */
.box { border: 1px solid var(--line); background: var(--panel); margin: 0 0 14px; }
.box > h2 { margin: 0; padding: 5px 10px; font: bold 14px "Trebuchet MS", Arial, sans-serif; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; background: linear-gradient(var(--head-a), var(--head-b)); border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.box > .body { padding: 10px 12px; }
.box > .body > :first-child { margin-top: 0; }
.box > .body > :last-child { margin-bottom: 0; }

/* Buttons and inputs */
.btn { display: inline-block; font: 13px Verdana, sans-serif; color: var(--ink); background: linear-gradient(var(--btn-a), var(--btn-b)); border: 1px solid var(--line); border-radius: 3px; padding: 6px 12px; cursor: pointer; box-shadow: var(--shadow); min-height: 32px; }
.btn:hover { border-color: var(--hot); color: var(--hot); }
.btn:disabled { opacity: .5; cursor: not-allowed; border-color: var(--line); color: var(--ink); }
.btn.primary { background: #2e5cbd; border-color: #1d4194; color: #fff; font-weight: bold; }
.btn.primary:hover { background: #3a6ad0; color: #fff; }
.btn.primary:disabled { background: #2e5cbd; color: #fff; }
.btn.small { padding: 3px 9px; font-size: 12px; min-height: 28px; }
input, select, textarea { font: 13px Verdana, sans-serif; color: var(--ink); background: var(--input); border: 1px solid var(--line); border-radius: 2px; padding: 5px 7px; max-width: 100%; }
textarea { resize: vertical; width: 100%; min-height: 32px; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); background: var(--bad-bg); }

/* Drop zone */
.drop { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 18px; margin: 0 0 14px; border: 2px dashed var(--line); background: var(--panel); border-radius: 4px; cursor: pointer; }
.drop strong { font: bold 17px "Trebuchet MS", Arial, sans-serif; }
.drop span { color: var(--mute); font-size: 13px; flex: 1 1 260px; }
.drop.over { border-color: var(--hot); background: var(--panel-2); }
.drop:focus-within { border-color: var(--hot); }
.drop:has(input:focus-visible) label.btn { outline: 2px solid var(--hot); outline-offset: 2px; }
.templates .btn { margin: 0 6px 6px 0; }

/* Status, notices and badges */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; }
.status { margin: 0; font-size: 13px; flex: 1 1 260px; }
.status.ok { color: var(--ok); }
.status.changed { color: var(--changed); }
.status.bad { color: var(--bad); }
.notice { padding: 9px 12px; border: 1px solid var(--line); border-left-width: 4px; margin: 0 0 14px; background: var(--panel); }
.notice.ok { border-left-color: var(--ok); background: var(--ok-bg); }
.notice.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.notice.bad { border-left-color: var(--bad); background: var(--bad-bg); }
.notice.info { border-left-color: var(--link); background: var(--info-bg); }
.badge { display: inline-block; font-size: 11px; line-height: 1.3; padding: 1px 6px; border: 1px solid currentColor; border-radius: 2px; vertical-align: 1px; white-space: nowrap; }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.bad { color: var(--bad); } .badge.changed { color: var(--changed); margin-left: 6px; }
.warn { color: var(--warn); } .bad { color: var(--bad); }
.changed-tag { color: var(--changed); }

/* Tables */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
.kv th { text-align: left; font-weight: normal; color: var(--mute); padding: 3px 14px 3px 0; white-space: nowrap; vertical-align: top; width: 1%; min-width: 10.5em; }
.kv td { padding: 3px 0; overflow-wrap: anywhere; }
.grid th, .grid td { text-align: left; padding: 7px 8px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.grid thead th { font-size: 12px; color: var(--mute); font-weight: normal; border-top: 0; border-bottom: 1px solid var(--line); }
.grid tbody th { font-weight: normal; }
.grid .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid tr.changed > * { background: color-mix(in srgb, var(--changed) 8%, transparent); }
.note { color: var(--faint); font-size: 12px; margin-top: 2px; max-width: 42ch; }
.hexval { overflow-wrap: anywhere; color: var(--mute); }

/* SFO editor */
.sfo th[scope="row"] { width: 34%; }
.sfo .val { width: 100%; }
.sfo .fmt { color: var(--faint); font-size: 12px; white-space: nowrap; width: 1%; }
.sfo .act { width: 1%; }
.sfo .meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; margin-top: 3px; }
.sfo .count { color: var(--faint); }
.sfo .count.over { color: var(--bad); }
.sfo .explain { color: var(--ok); }
.sfo .err { color: var(--bad); }
.sfo .ro { overflow-wrap: anywhere; }
.add-key { margin-top: 12px; }
.add-key summary { cursor: pointer; color: var(--link); }
.add-key .row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.add-key .key { width: 14em; } .add-key .max { width: 8em; }

/* Images */
.thumb { display: block; max-width: 144px; max-height: 90px; border: 1px solid var(--line); background: repeating-conic-gradient(#888 0 25%, #bbb 0 50%) 0 0/12px 12px; image-rendering: auto; }
.thumb.wide { max-width: 240px; max-height: 136px; }
.thumb.small { max-width: 120px; max-height: 70px; }
.thumb.ps3 { max-width: 160px; max-height: 88px; }
.thumb.missing { width: 128px; height: 72px; display: flex; align-items: center; justify-content: center; color: var(--bad); background: var(--bad-bg); font-size: 12px; }
.members .preview { min-width: 150px; }
.members .actions-cell .btn { margin: 0 4px 4px 0; }
.slots { display: flex; flex-wrap: wrap; gap: 16px; }
.slot { margin: 0; max-width: 260px; }
.slot figcaption { margin-top: 4px; font-size: 12px; }
.slot-actions { margin-top: 6px; display: flex; gap: 6px; }
.slot .warn { margin-top: 3px; }
.pkg-top { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.pkg-top .kv { width: auto; flex: 1 1 260px; }

/* XMB preview */
.xmb-wrap { max-width: 480px; }
.xmb { display: block; width: 100%; height: auto; aspect-ratio: 480 / 272; border: 1px solid var(--line); background: #000; }

/* LiveArea preview: 960x544 screen scaled down, background in the main area */
.la-wrap { max-width: 640px; margin: 10px 0 6px; }
.livearea { position: relative; aspect-ratio: 960 / 544; background: linear-gradient(#1e2a44, #0e1424); border: 1px solid var(--line); overflow: hidden; container-type: inline-size; }
.la-bg { position: absolute; left: 6.25%; top: 4%; width: 87.5%; height: 91.9%; object-fit: cover; }
.la-gate { position: absolute; left: 50%; top: 52%; width: 29.2%; transform: translateX(-50%); text-align: center; }
.la-gate img { display: block; width: 100%; aspect-ratio: 280 / 158; object-fit: cover; border-radius: 3px; box-shadow: 0 2px 8px rgba(0,0,0,.6); }
.la-gate span { display: inline-block; margin-top: 1.5cqw; padding: .3cqw 2.5cqw; font-size: 2.2cqw; color: #fff; background: rgba(255,255,255,.18); border-radius: 2cqw; }
.la-title { position: absolute; z-index: 2; left: 7.5%; top: 6%; font: bold 2.6cqw Verdana, sans-serif; color: #fff; text-shadow: 0 1px 3px #000; }
.la-frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 14px; }
.la-frame { border: 1px solid var(--line-soft); padding: 8px; background: var(--panel-2); }
.la-frame > strong { display: block; font-size: 12px; color: var(--mute); margin-bottom: 6px; }

/* Start page */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0 0 16px; }
.card { display: block; padding: 14px; border: 1px solid var(--line); background: linear-gradient(var(--btn-a), var(--btn-b)); border-radius: 4px; color: var(--ink); box-shadow: var(--shadow); }
.card strong { display: block; font: bold 19px "Trebuchet MS", Arial, sans-serif; color: var(--btn-ink); margin-bottom: 4px; }
.card span { color: var(--mute); font-size: 13px; }
.card:hover { border-color: var(--hot); text-decoration: none; }
.card:hover strong { color: var(--hot); }

/* Phones: the menu becomes a grid of buttons above the tool */
@media (max-width: 760px) {
  body { border: 0; }
  .top { flex-wrap: wrap; gap: 4px 12px; padding: 10px 16px; }
  .brand { font-size: 20px; gap: 10px; }
  .brand .logo { height: 30px; }
  .tagline { display: none; }
  .frame { display: block; padding: 10px 16px 20px; }
  .menu { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .menu li { margin: 0; }
  .menu li:first-child { grid-column: 1 / -1; }
  .menu a { font-size: 15px; padding: 11px 8px; text-align: center; min-height: 44px; }
  .menu li.on a { border-left: 1px solid var(--line); border-top: 4px solid var(--accent); padding: 8px 8px 11px; }
  h1 { font-size: 20px; }
  .sfo thead { display: none; }
  .sfo tr { display: grid; grid-template-columns: 1fr auto; border-top: 1px solid var(--line-soft); padding: 6px 0; }
  .sfo th, .sfo td { border: 0; padding: 3px 4px; }
  .sfo th[scope="row"] { width: auto; grid-column: 1 / -1; }
  .sfo td:nth-child(2) { grid-column: 1 / -1; }
  .sfo .fmt { width: auto; }
  .note { max-width: none; }
  .members thead { display: none; }
  .members tr { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line-soft); }
  .members th, .members td { border: 0; }
  .members th[scope="row"], .members .preview, .members .actions-cell { grid-column: 1 / -1; }
  .members .num { text-align: left; }
}

/* Image fix dialog */
dialog.fix { max-width: min(860px, calc(100vw - 32px)); width: 100%; background: var(--page); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 16px; }
dialog.fix::backdrop { background: rgba(0,0,0,.6); }
dialog.fix h2 { margin: 0 0 6px; font: bold 18px "Trebuchet MS", Arial, sans-serif; }
.fix-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 10px 0; }
.fix-grid figure { margin: 0; font-size: 12px; }
.fix-frame { display: flex; align-items: center; justify-content: center; min-height: 140px; padding: 6px; border: 1px solid var(--line); background: repeating-conic-gradient(#888 0 25%, #bbb 0 50%) 0 0/12px 12px; margin-bottom: 4px; }
.fix-img { max-width: 100%; max-height: 300px; image-rendering: auto; }
.fix-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13px; }
.slot.over, tr.over > * { outline: 2px dashed var(--hot); outline-offset: -2px; }
@media (max-width: 760px) { .fix-grid { grid-template-columns: 1fr; } }

/* Submission checks */
.lint-verdict { font-weight: bold; margin: 10px 0 6px; }
.lint-list { list-style: none; margin: 0; padding: 0; }
.lint-list li { display: flex; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.lint-list .mark { flex: none; width: 1.4em; height: 1.4em; line-height: 1.4em; text-align: center; border-radius: 50%; font-weight: bold; font-size: 12px; border: 1px solid currentColor; }
.lint-list .pass .mark { color: var(--ok); } .lint-list .info .mark { color: var(--link); } .lint-list .warn .mark { color: var(--warn); } .lint-list .fail .mark { color: var(--bad); }
.lint-list .fail { background: var(--bad-bg); } .lint-list .warn { background: var(--warn-bg); }

/* Batch */
.batch .verdict.pass { color: var(--ok); border-color: var(--ok); }
.batch .verdict.warn { color: var(--warn); border-color: var(--warn); }
.batch .verdict.fail { color: var(--bad); border-color: var(--bad); }
.batch tr.details > td { background: var(--panel-2); }
.drop .btn + .btn { margin-left: -6px; }

/* Make-from-scratch forms and the LiveArea builder */
details.make > summary { cursor: pointer; padding: 8px 12px; font-weight: bold; color: var(--link); }
details.make[open] > summary { border-bottom: 1px solid var(--line); }
.make-form .fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; margin-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.field input, .field select { width: 100%; }
.file-slot { padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.file-slot .btn { margin-left: 4px; }
.file-slot.over { outline: 2px dashed var(--hot); outline-offset: -2px; }
.la-builder .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.la-builder .la-frame input:not([type]) { width: 100%; margin: 4px 0; }

/* Compare */
.compare-zones { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.compare-zones .drop { margin-bottom: 4px; }
.compare-zones > div > p { margin: 0 0 14px; }
tr.diff-changed > * { background: color-mix(in srgb, var(--warn) 12%, transparent); }
tr.diff-added > * { background: color-mix(in srgb, var(--ok) 12%, transparent); }
tr.diff-removed > * { background: color-mix(in srgb, var(--bad) 12%, transparent); }
@media (max-width: 760px) { .compare-zones { grid-template-columns: 1fr; } }

/* The Brewology site bar above the workbench, desktop only, with a roomier header under it.
   The links are absolute so they work wherever the page is served from. */
.site-bar { display: flex; align-items: center; gap: 18px; padding: 7px 16px; font: 13px/1.4 Verdana, Arial, sans-serif; background: var(--head-b); border-bottom: 1px solid var(--line); color: var(--mute); }
.site-bar a { color: var(--link); text-decoration: none; }
.site-bar a:hover { text-decoration: underline; }
.site-bar .home { font-weight: bold; color: var(--ink); }
.site-bar nav { display: flex; gap: 16px; flex-wrap: wrap; }
@media (min-width: 761px) { .top { padding: 22px 16px; } .brand .logo { height: 50px; } }
@media (max-width: 760px) { .site-bar { display: none; } }
/* Browsers without the HTML5 hidden attribute (the old console browsers) still honour this. */
[hidden] { display: none !important; }
