:root {
  --ink: #102A43;
  --muted: #486581;
  --paper: #ffffff;
  --canvas: #ffffff;
  --line: #c7ddd9;
  --green: #00A896;
  --green-soft: #ddf6f1;
  --gold: #b85b00;
  --gold-soft: #fff0d9;
  --red: #bf2d2d;
  --red-soft: #fbe5e4;
  --blue: #102A43;
  --blue-soft: #eaf0f5;
  --grey-soft: #eef4f3;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 14px/1.45 Calibri, Candara, "Segoe UI", Arial, sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 20% minmax(0, 1fr); gap: 20px; padding: 16px; }
.lucky-charm { position: fixed; right: 26px; bottom: 24px; z-index: 4; width: clamp(48px, 4vw, 62px); pointer-events: none; }
.lucky-charm img { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 14px rgba(16, 42, 67, .17)); }
.app-sidebar { position: sticky; top: 16px; height: calc(100vh - 32px); min-width: 0; padding: 28px 20px; border-radius: 8px; background: var(--blue); color: #fff; display: flex; flex-direction: column; }
.app-header { display: flex; align-items: center; justify-content: center; }
.brand { display: flex; align-items: center; width: max-content; padding: 10px 12px; border: 1px solid #d6e1e5; border-radius: 5px; background: #fff; box-shadow: inset 0 2px 5px rgba(16, 42, 67, .22), inset 0 1px 0 rgba(255, 255, 255, .9); text-decoration: none; transition: transform .18s ease, box-shadow .18s ease; }
.brand:hover { transform: translateY(-3px); box-shadow: inset 0 2px 5px rgba(16, 42, 67, .16), inset 0 1px 0 rgba(255, 255, 255, .9), 0 7px 14px rgba(5, 25, 42, .24); }
.brand:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.brand img { display: block; height: 48px; width: auto; }
.health { color: var(--green); font-size: 12px; font-weight: 700; }
.sidebar-guide { appearance: none; display: inline-flex; align-items: center; justify-content: center; width: 100%; gap: 8px; margin-top: auto; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 5px; background: transparent; color: #fff; font-size: 13px; font-weight: 700; text-decoration: none; transition: transform .18s ease, background .18s ease, border-color .18s ease; }
.sidebar-guide:hover { transform: translateY(-1px); border-color: var(--green); background: rgba(0, 168, 150, .18); }
.sidebar-guide:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.sidebar-guide svg { width: 16px; height: 16px; }
.sidebar-status { padding-top: 14px; text-align: center; }
main { min-width: 0; padding: 20px 24px 64px 4px; }
.tabs { display: flex; flex-direction: column; gap: 6px; margin: 42px 0 0; }
.tab { appearance: none; width: 100%; border: 0; border-left: 3px solid transparent; border-radius: 0 5px 5px 0; background: transparent; padding: 12px 13px; color: #d3e0e8; font-weight: 700; text-align: left; transition: background .18s ease, color .18s ease, border-color .18s ease; }
.tab:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.tab.active { color: #fff; border-left-color: var(--green); background: rgba(0, 168, 150, .18); }
.view { display: none; }
.view.active { display: block; }
.page-heading { display: flex; align-items: end; justify-content: space-between; margin: 0 0 20px; gap: 18px; }
.page-heading-actions, .run-actions { display: flex; align-items: center; gap: 10px; }
h1 { margin: 0; font-size: 25px; line-height: 1.15; letter-spacing: 0; }
.page-heading p { margin: 5px 0 0; color: var(--muted); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 16px; }
.panel-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-head h2 { margin: 0; font-size: 15px; letter-spacing: 0; }
.common-cases-title { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; min-width: 0; }
.common-cases-title h2 span { color: var(--green); }
.template-selection { display: flex; align-items: center; gap: 12px; }
.panel-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.panel-body { padding: 18px; }
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 12px; margin-right: 8px; }
.game-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.game-type { appearance: none; text-align: left; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); padding: 16px; min-height: 90px; color: var(--ink); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.game-type:not(:disabled):hover { transform: translateY(-2px); border-color: var(--green); box-shadow: 0 5px 12px rgba(16, 42, 67, .10); }
.game-type.selected { border: 2px solid var(--green); background: #f4fbfa; padding: 15px; }
.game-types.locked .game-type:not(.selected) { opacity: .52; }
.game-type b { display: block; font-size: 15px; margin-bottom: 5px; }
.game-type small { color: var(--muted); display: block; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
label { display: block; color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 6px; }
input, select, textarea { width: 100%; border: 1px solid #afcac5; border-radius: 5px; background: white; color: var(--ink); padding: 10px 11px; min-height: 40px; }
textarea { resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: 2px solid #80d7cc; border-color: var(--green); }
.span-all { grid-column: 1 / -1; }
.inline { display: flex; align-items: end; gap: 10px; }
.inline > div { flex: 1; }
.button { border: 1px solid var(--line); border-radius: 5px; background: var(--paper); padding: 10px 13px; min-height: 40px; color: var(--ink); font-weight: 700; white-space: nowrap; transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease, color .18s ease; }
.button:not(:disabled):hover { transform: translateY(-1px); background: var(--blue-soft); border-color: #91b6bd; box-shadow: 0 3px 8px rgba(16, 42, 67, .10); }
.button.primary { background: var(--green); border-color: var(--green); color: white; }
.button.primary:not(:disabled):hover { background: #008c7d; border-color: #008c7d; color: #fff; }
.button.danger { color: var(--red); border-color: #e8bdbb; }
.button.danger:not(:disabled):hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.reset-button { display: inline-flex; align-items: center; gap: 7px; background: #eef2f3; border-color: #d4dedf; color: var(--ink); }
.reset-button:not(:disabled):hover { background: #e4ebed; border-color: #bdcccf; }
.reset-button svg { width: 16px; height: 16px; }
.button:focus-visible, .game-type:focus-visible, .tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.notice { margin-top: 12px; padding: 10px 12px; background: var(--grey-soft); border-left: 3px solid var(--muted); color: var(--muted); font-size: 13px; }
.notice.pass { background: var(--green-soft); border-color: var(--green); color: #076b61; }
.notice.warn { background: var(--gold-soft); border-color: var(--gold); color: #764000; }
.notice.fail { background: var(--red-soft); border-color: var(--red); color: #8d2525; }
.mode-select { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.mode { border: 1px solid var(--line); border-radius: 6px; padding: 14px; background: var(--paper); cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.mode:not(:disabled):hover { transform: translateY(-2px); border-color: #91b6bd; box-shadow: 0 5px 12px rgba(16, 42, 67, .10); }
.mode.selected { border: 2px solid var(--blue); background: #f4f8fb; padding: 13px; }
.mode b { display: block; font-size: 14px; }
.mode small { color: var(--muted); }
.file-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.file-row input { max-width: 340px; padding: 7px; }
.file-name { color: var(--muted); font-size: 13px; }
.upload-list { display: grid; gap: 7px; margin-top: 12px; }
.upload-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 10px; background: #f8fbfa; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; }
.upload-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item small { color: var(--muted); }
.upload-state { border-radius: 999px; padding: 3px 7px; font-size: 11px; font-weight: 800; background: var(--grey-soft); color: var(--muted); white-space: nowrap; }
.upload-state.ready { background: var(--green-soft); color: var(--green); }
.upload-state.error { background: var(--red-soft); color: var(--red); }
.run-bar { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 16px 18px; background: #e9f7f4; border: 1px solid #b9e6dd; border-radius: 6px; }
.run-summary { min-width: 0; }
.run-case-breakdown { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 5px; }
.run-case-breakdown span { color: var(--ink); font-size: 14px; font-weight: 700; }
.run-case-breakdown b { display: inline; color: var(--green); font-size: 15px; }
.run-summary > span { color: var(--muted); font-size: 13px; }
.result-panel { display: none; }
.result-panel.active { display: block; }
.progress { height: 7px; background: #d2e9e4; overflow: hidden; margin-top: 15px; }
.progress > div { height: 100%; width: 0; background: var(--green); transition: width .2s; }
.result-meta { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 13px; }
.result-filter { display: inline-flex; align-items: center; gap: 7px; margin: 0; color: var(--muted); font-size: 12px; white-space: nowrap; }
.result-filter select { width: auto; min-height: 34px; padding: 6px 28px 6px 8px; color: var(--ink); font-size: 13px; font-weight: 700; }
.count-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.count { padding: 4px 9px; font-size: 12px; font-weight: 700; border-radius: 999px; background: var(--grey-soft); color: var(--muted); }
.count.pass { background: var(--green-soft); color: var(--green); }
.count.fail { background: var(--red-soft); color: var(--red); }
.count.manual { background: var(--gold-soft); color: #885000; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 740px; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; padding: 9px 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid #e6f0ee; vertical-align: top; }
.status { display: inline-block; border-radius: 999px; padding: 3px 7px; font-size: 11px; font-weight: 800; background: var(--grey-soft); color: var(--muted); }
.status.PASS { background: var(--green-soft); color: var(--green); }
.status.FAIL { background: var(--red-soft); color: var(--red); }
.status.MANUAL { background: var(--gold-soft); color: #885000; }
.status.SKIPPED { background: var(--grey-soft); color: var(--muted); }
.screenshot-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; color: #076b61; font-size: 12px; font-weight: 700; text-decoration: none; }
.screenshot-link:hover { color: var(--green); text-decoration: underline; }
.screenshot-link svg { width: 14px; height: 14px; }
.template-toolbar { display: grid; grid-template-columns: minmax(280px, 340px) minmax(300px, 1fr) auto; gap: 10px; align-items: end; }
.template-toolbar label { margin-bottom: 0; }
.template-controls-panel { background: #eaf8f5; border-color: #b9e6dd; }
.template-controls-panel .panel-head { border-bottom-color: #b9e6dd; }
.template-type-picker { padding: 0; background: transparent; }
.template-type-picker label { color: var(--ink); font-size: 12px; }
.template-type-picker select { margin-top: 7px; min-height: 43px; border-color: #9dccc5; color: var(--ink); font-weight: 800; }
.template-import-control { display: flex; align-items: center; gap: 9px; min-height: 43px; margin-top: 7px; }
.file-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.file-picker { display: inline-flex; align-items: center; gap: 7px; min-height: 43px; padding: 0 12px; border: 1px solid var(--green); border-radius: 5px; background: #fff; color: #076b61; cursor: pointer; font-size: 13px; font-weight: 800; white-space: nowrap; transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.file-picker:hover { transform: translateY(-1px); background: #f4fbfa; border-color: #008c7d; box-shadow: 0 3px 8px rgba(0, 168, 150, .14); }
.file-picker svg { width: 16px; height: 16px; }
#import-template:hover { background: var(--green-soft); border-color: var(--green); color: #076b61; }
.template-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.add-template-button { display: inline-flex; align-items: center; gap: 7px; }
.add-template-button svg { width: 16px; height: 16px; }
.template-select-all { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--ink); font-size: 13px; cursor: pointer; }
.template-select-all input, .case-select-control input { width: 16px; height: 16px; min-height: auto; margin: 0; accent-color: var(--green); }
.selection-count { color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.bulk-delete-button { display: inline-flex; align-items: center; gap: 7px; }
.bulk-delete-button[hidden] { display: none !important; }
.bulk-delete-button svg { width: 16px; height: 16px; }
.report-button { display: inline-flex; align-items: center; gap: 7px; }
.report-button svg { width: 16px; height: 16px; }
.case-list { border-top: 1px solid var(--line); }
.case-item { display: grid; grid-template-columns: 24px minmax(240px, 1fr) auto auto; align-items: center; gap: 16px; padding: 15px 4px; border-bottom: 1px solid var(--line); }
.case-item.selected { background: #f4fbfa; }
.case-select-control { display: grid; place-items: center; width: 20px; height: 20px; margin: 0; }
.case-title { display: flex; align-items: start; gap: 11px; min-width: 0; }
.case-id { flex: 0 0 auto; padding: 3px 6px; border-radius: 4px; background: var(--blue-soft); color: var(--blue); font-size: 11px; font-weight: 800; }
.case-title strong { display: block; font-size: 14px; }
.case-title small { display: block; margin-top: 2px; color: var(--muted); }
.case-context, .result-context { margin-top: 8px; color: var(--muted); font-size: 12px; }
.case-context summary, .result-context summary { width: max-content; color: #076b61; cursor: pointer; font-weight: 700; }
.execution-context-fields { display: grid; gap: 8px; margin-top: 9px; padding: 10px; border-left: 2px solid var(--green); background: #f4fbfa; }
.execution-context-fields b { display: block; margin-bottom: 2px; color: var(--ink); font-size: 11px; }
.execution-context-fields span { display: block; overflow-wrap: anywhere; white-space: pre-wrap; }
.case-meta { display: flex; flex-wrap: wrap; justify-content: end; gap: 6px; max-width: 370px; }
.case-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; background: var(--grey-soft); color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.case-badge.lite { background: var(--green-soft); color: #076b61; }
.case-badge.deep { background: var(--blue-soft); color: var(--blue); }
.case-actions { display: flex; gap: 5px; }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--blue); transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease; }
.icon-button:hover { transform: translateY(-1px); border-color: var(--green); background: #f4fbfa; color: var(--green); box-shadow: 0 3px 8px rgba(16, 42, 67, .10); }
.icon-button.delete-case { color: var(--red); }
.icon-button.delete-case:hover { border-color: var(--red); color: var(--red); }
.icon-button svg { width: 16px; height: 16px; }
.modal { position: fixed; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(16, 42, 67, .42); }
.modal.open { display: flex; }
.modal-dialog { width: min(760px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; background: var(--paper); border-radius: 6px; box-shadow: 0 18px 50px rgba(16, 42, 67, .22); }
.confirm-dialog { width: min(430px, 100%); }
.guide-dialog { width: min(1120px, 100%); height: min(860px, calc(100vh - 40px)); }
.guide-actions { display: flex; align-items: center; gap: 8px; }
.guide-download { display: inline-flex; align-items: center; gap: 7px; }
.guide-download svg { width: 16px; height: 16px; }
.guide-body { flex: 1; min-height: 0; padding: 0; overflow: hidden; }
.guide-body iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.modal-head, .modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.modal-head { border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-actions { justify-content: end; border-top: 1px solid var(--line); }
.confirmation-message { margin: 0; color: var(--muted); font-size: 15px; }
.button.confirm-delete-button { display: inline-flex; align-items: center; gap: 7px; background: var(--red); border-color: var(--red); color: #fff; }
.button.confirm-delete-button:not(:disabled):hover { background: #9f2222; border-color: #9f2222; color: #fff; }
.confirm-delete-button svg { width: 16px; height: 16px; }
.modal-actions #confirm-delete-action { display: inline-flex; align-items: center; gap: 7px; }
.modal-actions #confirm-delete-action svg { width: 16px; height: 16px; }
.check-field { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; font-weight: 700; }
.check-field input { width: 16px; min-height: auto; }
.generated-id { display: flex; align-items: center; min-height: 40px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 5px; background: var(--grey-soft); color: var(--muted); font-weight: 800; }
.empty { color: var(--muted); padding: 22px 0; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .lucky-charm { position: absolute; right: 18px; bottom: 18px; width: 38px; }
  .app-shell { position: relative; display: block; padding: 12px 12px 132px; }
  .app-sidebar { position: static; height: auto; min-height: auto; padding: 16px 18px; }
  .sidebar-status { display: none; }
  .sidebar-guide { margin-top: 18px; }
  main { padding: 24px 2px 48px; }
  .brand img { height: 38px; }
  .tabs { flex-direction: row; gap: 8px; margin: 18px 0 0; overflow-x: auto; }
  .tab { width: auto; flex: 0 0 auto; border-left: 0; border-bottom: 3px solid transparent; border-radius: 4px 4px 0 0; padding: 9px 10px; }
  .tab.active { border-left-color: transparent; border-bottom-color: var(--green); }
  .game-types, .form-grid, .mode-select { grid-template-columns: 1fr; }
  .template-toolbar { grid-template-columns: 1fr; }
  .case-item { grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; }
  .case-select-control { grid-column: 1; grid-row: 1; }
  .case-title { grid-column: 2; }
  .case-meta { grid-column: 2 / -1; justify-content: start; max-width: none; }
  .case-actions { grid-column: 3; grid-row: 1; }
  .page-heading, .run-bar, .common-cases-head { align-items: stretch; flex-direction: column; }
  .common-cases-title { flex-wrap: wrap; }
  .panel-head-actions { min-width: 0; justify-content: flex-start; }
  .common-cases-head .panel-head-actions { width: 100%; max-width: 100%; gap: 8px; }
  .guide-dialog { height: calc(100vh - 24px); }
  .guide-download { min-height: 34px; padding: 7px 9px; }
}
