:root {
  --bg: #101216;
  --panel: #101216;
  --panel-strong: #16161a;
  --surface: #1d2025;
  --surface-strong: #101216;
  --border: #31343a;
  --border-strong: #454b57;
  --text: #fffffe;
  --muted: #94a1b2;
  --icon-secondary: #72757e;
  --accent: #7f5af0;
  --accent-rgb: 127, 90, 240;
  --accent-soft: rgba(var(--accent-rgb), 0.1);
  --accent-soft-strong: rgba(var(--accent-rgb), 0.18);
  --accent-soft-subtle: rgba(var(--accent-rgb), 0.08);
  --success: #2cb67d;
  --warning: #f2c66d;
  --error: #ff7a90;
  --success-strong: #89e6bc;
  --error-strong: #ffb3c1;
  --surface-subtle: #202328;
  --surface-subtle-strong: #262a30;
  --surface-overlay: rgba(22, 22, 26, 0.82);
  --surface-overlay-strong: rgba(22, 22, 26, 0.84);
  --terminal-surface: rgba(20, 22, 26, 0.94);
  --focus-ring: rgba(var(--accent-rgb), 0.34);
  --splitter-line: rgba(148, 161, 178, 0.16);
  --splitter-line-hover: rgba(255, 255, 254, 0.18);
  --success-border: rgba(44, 182, 125, 0.36);
  --warning-border: rgba(242, 198, 109, 0.34);
  --error-border: rgba(255, 122, 144, 0.34);
  --button-border: rgba(var(--accent-rgb), 0.42);
  --overlay-handle-border: rgba(255, 255, 254, 0.9);
  --debug-border: rgba(255, 255, 254, 0.68);
  --debug-bg: rgba(255, 255, 254, 0.04);
  --debug-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.34);
  --ghost-text: rgba(148, 161, 178, 0.42);
  --suggestion-border: rgba(69, 75, 87, 0.76);
  --suggestion-text: var(--muted);
  --suggestion-selected-text: var(--text);
  --suggestion-selected-name-text: var(--suggestion-selected-text);
  --suggestion-type-text: rgba(148, 161, 178, 0.7);
  --suggestion-match-text: var(--text);
  --blink-hidden: rgba(20, 22, 26, 0.08);
  --my-accent: #5ea0ff;
  --my-accent-rgb: 94, 160, 255;
  --my-accent-soft: rgba(var(--my-accent-rgb), 0.13);
  --my-accent-soft-strong: rgba(var(--my-accent-rgb), 0.08);
  --my-accent-border: rgba(var(--my-accent-rgb), 0.88);
  --my-handle-border: #edf5ff;
  --loading-accent-border: rgba(114, 117, 126, 0.94);
  --loading-accent-bg: rgba(114, 117, 126, 0.12);
  --committed-accent-border: rgba(255, 225, 120, 0.92);
  --committed-accent-bg: rgba(255, 225, 120, 0.12);
  --timer-accent-border: rgba(44, 182, 125, 0.92);
  --timer-accent-bg: rgba(44, 182, 125, 0.12);
  --battle-accent-border: rgba(120, 210, 255, 0.92);
  --battle-accent-bg: rgba(120, 210, 255, 0.08);
  --shadow: none;
  --radius: 0;
  --toolbar-height: 36px;
  --terminal-panel-default-size: clamp(148px, 18svh, 196px);
  --mono: "Cascadia Code", "Consolas", "BIZ UDGothic", monospace;
  --terminal-mono: "UDEV Gothic", "UDEV Gothic 35JPDOC", "BIZ UDGothic", Consolas, monospace;
  --toolbar-ui: "LINE Seed JP", "Yu Gothic UI", "BIZ UDPGothic", "Hiragino Sans", sans-serif;
  --ui: "Yu Gothic UI", "BIZ UDPGothic", "Hiragino Sans", sans-serif;
}

html {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #fffffe;
  --panel: #fffffe;
  --panel-strong: #f6fbfb;
  --surface: #ffffff;
  --surface-strong: #e3f6f5;
  --border: #bae8e8;
  --border-strong: rgba(39, 35, 67, 0.28);
  --text: #272343;
  --muted: #4f5875;
  --icon-secondary: #66718d;
  --accent: #ffd803;
  --accent-rgb: 255, 216, 3;
  --accent-soft: rgba(var(--accent-rgb), 0.28);
  --accent-soft-strong: rgba(var(--accent-rgb), 0.42);
  --accent-soft-subtle: rgba(var(--accent-rgb), 0.18);
  --success: #1f7a5a;
  --warning: #9a6500;
  --error: #b24868;
  --success-strong: #145d45;
  --error-strong: #8d2e4f;
  --surface-subtle: #e3f6f5;
  --surface-subtle-strong: #f6fbfb;
  --surface-overlay: rgba(255, 255, 255, 0.92);
  --surface-overlay-strong: rgba(255, 255, 255, 0.94);
  --terminal-surface: #f9fcfc;
  --focus-ring: rgba(39, 35, 67, 0.22);
  --splitter-line: rgba(39, 35, 67, 0.14);
  --splitter-line-hover: rgba(39, 35, 67, 0.24);
  --success-border: rgba(31, 122, 90, 0.34);
  --warning-border: rgba(154, 101, 0, 0.36);
  --error-border: rgba(178, 72, 104, 0.34);
  --button-border: rgba(39, 35, 67, 0.2);
  --overlay-handle-border: rgba(255, 255, 255, 0.96);
  --debug-border: rgba(39, 35, 67, 0.48);
  --debug-bg: rgba(39, 35, 67, 0.05);
  --debug-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  --ghost-text: rgba(79, 88, 117, 0.48);
  --suggestion-border: rgba(39, 35, 67, 0.22);
  --suggestion-text: #2d334a;
  --suggestion-selected-text: #0f172f;
  --suggestion-selected-name-text: #272343;
  --suggestion-type-text: #64708f;
  --suggestion-match-text: #272343;
  --blink-hidden: rgba(39, 35, 67, 0.12);
  --my-accent-soft: rgba(var(--my-accent-rgb), 0.18);
  --my-accent-soft-strong: rgba(var(--my-accent-rgb), 0.12);
  --my-accent-border: rgba(var(--my-accent-rgb), 0.92);
  --my-handle-border: #ffffff;
  --loading-accent-bg: rgba(114, 117, 126, 0.16);
  --committed-accent-border: rgba(255, 216, 3, 0.94);
  --committed-accent-bg: rgba(255, 216, 3, 0.22);
  --battle-accent-bg: rgba(120, 210, 255, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  overflow: hidden;
}

body.is-layout-resizing,
body.is-layout-resizing * {
  user-select: none;
}

body.is-layout-resizing[data-layout-resize-axis="y"],
body.is-layout-resizing[data-layout-resize-axis="y"] * {
  cursor: ns-resize !important;
}

body.is-layout-resizing[data-layout-resize-axis="x"],
body.is-layout-resizing[data-layout-resize-axis="x"] * {
  cursor: ew-resize !important;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  --terminal-panel-size: var(--terminal-panel-default-size);
  --splitter-hit-size: 14px;
  width: 100%;
  height: 100vh;
  height: 100svh;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--panel);
  border: 1px solid var(--border);
}

.workspace-top {
  --workspace-pane-default-size: clamp(176px, 15vw, 220px);
  --workspace-pane-left-size: var(--workspace-pane-default-size);
  --workspace-pane-right-size: var(--workspace-pane-default-size);
  --workspace-pane-min-size: 0px;
  --workspace-center-min-size: 280px;
  --workspace-column-splitter-hit-size: 14px;
  display: grid;
  grid-template-columns:
    minmax(var(--workspace-pane-min-size), var(--workspace-pane-left-size))
    var(--workspace-column-splitter-hit-size)
    minmax(var(--workspace-center-min-size), 1fr)
    var(--workspace-column-splitter-hit-size)
    minmax(var(--workspace-pane-min-size), var(--workspace-pane-right-size));
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "toolbar toolbar toolbar toolbar toolbar"
    "my split-left live split-right enemy";
  gap: 0;
  align-items: stretch;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

html:not([data-theme="light"]) .workspace-top {
  background: var(--panel-strong);
}

html[data-theme="light"] .workspace-top {
  background: var(--panel);
}

.layout-splitter {
  position: relative;
  flex: 0 0 var(--splitter-hit-size);
  min-height: var(--splitter-hit-size);
  background: var(--panel-strong);
  cursor: ns-resize;
  touch-action: none;
}

.layout-splitter::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 50%;
  height: 1px;
  transform: translateY(-50%);
  background: var(--splitter-line);
  transition: background-color 120ms ease;
}

.layout-splitter:hover::before,
.layout-splitter.is-active::before {
  background: var(--splitter-line-hover);
}

.workspace-column-splitter {
  position: relative;
  min-width: var(--workspace-column-splitter-hit-size);
  background: var(--panel-strong);
  cursor: ew-resize;
  touch-action: none;
}

.workspace-column-splitter::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: var(--splitter-line);
  transition: background-color 120ms ease;
}

.workspace-column-splitter--left {
  grid-area: split-left;
}

.workspace-column-splitter--right {
  grid-area: split-right;
}

.workspace-column-splitter:hover::before,
.workspace-column-splitter.is-active::before {
  background: var(--splitter-line-hover);
}

html[data-theme="light"] .layout-splitter,
html[data-theme="light"] .workspace-column-splitter {
  background: var(--panel);
}

.panel {
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.crop-panel {
  min-width: 0;
  padding: 10px 14px 3px;
}

.crop-panel[data-collapsed="true"] {
  padding: 0;
}

.crop-panel[data-collapsed="true"] .crop-preview-shell {
  visibility: hidden;
  pointer-events: none;
}

.crop-panel--my {
  padding-right: 7px;
}

.live-panel {
  padding: 10px 7px 3px;
}

.crop-panel--enemy {
  padding-left: 7px;
}

.workspace-toolbar {
  padding: 10px 14px;
}

.workspace-toolbar {
  grid-area: toolbar;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 0;
  border-bottom: 1px solid var(--border);
}

.toolbar-main-controls {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-toolbar,
.workspace-toolbar .ui-button,
.workspace-toolbar .toolbar-select,
.camera-badge {
  font-family: var(--toolbar-ui);
}

.live-panel {
  grid-area: live;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.camera-badge {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--toolbar-height);
  min-height: var(--toolbar-height);
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  width: 108px;
  min-width: 108px;
  text-align: center;
  flex: 0 0 auto;
  white-space: nowrap;
}

.camera-badge[data-tone="success"] {
  color: var(--success);
  border-color: var(--success-border);
}

.camera-badge[data-tone="working"] {
  color: var(--warning);
  border-color: var(--warning-border);
}

.camera-badge[data-tone="error"] {
  color: var(--error);
  border-color: var(--error-border);
}

.terminal-form {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  align-items: center;
}

.toolbar-select {
  min-width: 0;
  height: var(--toolbar-height);
  min-height: var(--toolbar-height);
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.toolbar-select--video {
  flex: 1 1 0;
}

.toolbar-select--audio {
  flex: 1 1 0;
  width: auto;
}

.crop-controls {
  display: none;
}

.field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.field--grow {
  flex: 1 1 280px;
}

.field input,
.field select {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}

.field input:disabled,
.field select:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.ui-button {
  height: var(--toolbar-height);
  min-height: var(--toolbar-height);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--button-border);
  border-radius: 2px;
  background: var(--accent-soft);
  color: var(--text);
  cursor: pointer;
  flex: 0 0 auto;
  transition:
    border-color 120ms ease,
    background-color 120ms ease,
    color 120ms ease;
}

.ui-button:hover {
  background: var(--accent-soft-strong);
}

.ui-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.ui-button--subtle {
  border-color: var(--border-strong);
  background: var(--surface);
}

.ui-button--icon {
  width: var(--toolbar-height);
  min-width: var(--toolbar-height);
  padding: 0;
}

.toolbar-icon {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
}

.toolbar-icon--fullscreen,
.toolbar-icon--audio,
.toolbar-icon--theme {
  display: none;
}

.fullscreen-button[data-icon-state="enter"] .toolbar-icon--fullscreen-enter,
.fullscreen-button[data-icon-state="exit"] .toolbar-icon--fullscreen-exit,
.audio-button[data-icon-state="unmuted"] .toolbar-icon--audio-on,
.audio-button[data-icon-state="muted"] .toolbar-icon--audio-muted,
.theme-toggle-button[data-icon-state="dark"] .toolbar-icon--theme-moon,
.theme-toggle-button[data-icon-state="light"] .toolbar-icon--theme-sun {
  display: block;
}

.fullscreen-button {
  flex: 0 0 auto;
}

.theme-toggle-button[data-icon-state="light"] {
  border-color: rgba(var(--accent-rgb), 0.52);
  background: var(--accent-soft);
}

.audio-button {
  flex: 0 0 auto;
}

.audio-control {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  min-width: 40px;
  height: var(--toolbar-height);
  overflow: visible;
  z-index: 4;
}

.audio-control::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: var(--toolbar-height);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  background: var(--surface);
  pointer-events: none;
  transition:
    height 160ms ease,
    border-color 120ms ease,
    background-color 120ms ease;
}

.audio-control:hover .audio-volume-shell,
.audio-control:focus-within .audio-volume-shell {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.audio-control:hover::before,
.audio-control:focus-within::before {
  height: 160px;
}

.audio-control .audio-button {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  min-height: var(--toolbar-height);
  height: var(--toolbar-height);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  flex: 0 0 auto;
}

.audio-control .audio-button:hover {
  background: var(--accent-soft-subtle);
}

.ui-button:focus-visible,
.toolbar-select:focus-visible,
.audio-volume:focus-visible,
.toolbar-help-link:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.audio-volume-shell {
  position: absolute;
  left: 0;
  top: var(--toolbar-height);
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  padding: 8px 0 10px;
  transform: translateY(-8px);
  transition:
    opacity 120ms ease,
    transform 160ms ease;
}

.audio-volume {
  width: 16px;
  min-width: 16px;
  height: 102px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  background: transparent;
  flex: 0 0 auto;
  writing-mode: vertical-lr;
  direction: rtl;
}

.toolbar-help-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-inline-start: 4px;
  color: var(--icon-secondary);
  text-decoration: none;
  outline: none;
}

.toolbar-help-link:hover,
.toolbar-help-link:focus-visible {
  color: var(--text);
}

.toolbar-icon--help {
  width: 20px;
  height: 20px;
}

.helper-text {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.helper-text--dim {
  color: var(--icon-secondary);
}

.video-stage-shell {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.video-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 100%;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--panel-strong);
  flex: 0 0 auto;
}

html:not([data-theme="light"]) .video-stage {
  background: var(--panel);
}

.video-stage video {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--surface-strong);
  object-fit: contain;
}

.video-stage[data-ready="false"] video {
  opacity: 0;
}

.video-stage[data-ready="true"] video {
  opacity: 1;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
}

.video-stage[data-ready="true"] .video-placeholder {
  display: none;
}

.crop-overlay {
  position: absolute;
  border: 2px solid var(--accent);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-rgb), 0.03));
  cursor: move;
  touch-action: none;
}

.crop-overlay.is-hidden {
  display: none;
}

.crop-overlay__label {
  position: absolute;
  left: -2px;
  top: -22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  line-height: 1;
  color: var(--text);
  background: var(--surface-overlay);
}

.crop-overlay__handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--overlay-handle-border);
  background: var(--accent);
  cursor: nwse-resize;
}

.crop-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.crop-panel--my {
  grid-area: my;
}

.crop-panel--enemy {
  grid-area: enemy;
}

.crop-overlay--my {
  border-color: var(--my-accent);
  background: linear-gradient(180deg, var(--my-accent-soft), rgba(var(--my-accent-rgb), 0.03));
}

.crop-overlay--my .crop-overlay__handle {
  background: var(--my-accent);
  border-color: var(--my-handle-border);
}

.crop-overlay--enemy {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-rgb), 0.03));
}

.debug-overlay {
  position: absolute;
  border: 1px dashed var(--debug-border);
  background: var(--debug-bg);
  pointer-events: none;
  box-shadow: var(--debug-shadow);
}

.debug-overlay.is-hidden {
  display: none;
}

.debug-overlay__label {
  position: absolute;
  left: -1px;
  top: -20px;
  display: inline-flex;
  align-items: center;
  min-width: 48px;
  height: 18px;
  padding: 0 6px;
  font-size: 10px;
  line-height: 1;
  color: var(--text);
  background: var(--surface-overlay-strong);
  letter-spacing: 0.02em;
}

.debug-overlay--my {
  border-color: var(--my-accent-border);
  background: var(--my-accent-soft-strong);
}

.debug-overlay--enemy {
  border-color: rgba(var(--accent-rgb), 0.9);
  background: rgba(var(--accent-rgb), 0.08);
}

.debug-overlay--loading {
  border-color: var(--loading-accent-border);
  background: var(--loading-accent-bg);
}

.debug-overlay--committed {
  border-color: var(--committed-accent-border);
  background: var(--committed-accent-bg);
}

.debug-overlay--timer {
  border-color: var(--timer-accent-border);
  background: var(--timer-accent-bg);
}

.debug-overlay--battle {
  border-color: var(--battle-accent-border);
  background: var(--battle-accent-bg);
}

.crop-preview-shell {
  position: relative;
  display: grid;
  place-items: center;
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--panel-strong);
}

html:not([data-theme="light"]) .crop-preview-shell {
  background: var(--panel);
}

.crop-preview-shell canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  background: var(--surface-strong);
}

.crop-preview-shell[data-ready="false"] canvas {
  display: none;
}

.crop-placeholder {
  display: none;
}

.crop-preview-shell[data-ready="true"] .crop-placeholder {
  display: none;
}

.terminal-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  flex: 0 0 var(--terminal-panel-size, var(--terminal-panel-default-size));
  overflow: hidden;
  background: var(--panel-strong);
}

html[data-theme="light"] .terminal-panel {
  background: var(--panel);
}

.terminal-panel[data-collapsed="true"] #terminal-screen {
  visibility: hidden;
  pointer-events: none;
}

.terminal-output {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  height: auto;
  flex: 1 1 auto;
  margin: 0 14px 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  background: var(--panel);
  font-family: var(--terminal-mono);
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
}

html[data-theme="light"] .terminal-output {
  background: var(--panel-strong);
  color: #272343;
}

html[data-theme="light"] .terminal-prompt,
html[data-theme="light"] .terminal-input-wrap input,
html[data-theme="light"] .terminal-entry--command {
  color: #272343;
  caret-color: #272343;
}

html[data-theme="light"] .terminal-entry--system {
  color: #4b4a67;
}

.terminal-log {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
}

.terminal-entry--input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: 0;
  margin: 0;
  flex: 0 0 auto;
  font-family: var(--terminal-mono);
  font-size: 13px;
  line-height: 1.35;
}

.terminal-panel[data-terminal-mode="compact"] .terminal-output {
  gap: 0;
  margin-bottom: 0;
  padding-top: 6px;
  padding-bottom: 6px;
}

.terminal-panel[data-terminal-mode="compact"] .terminal-log {
  display: none;
}

.terminal-panel[data-terminal-mode="compact"] .terminal-suggestions {
  margin-bottom: 2px;
}

.terminal-prompt {
  flex: 0 0 auto;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  white-space: pre;
}

.terminal-prompt--active {
  animation: terminal-prompt-blink 1.1s steps(1, end) infinite;
}

.terminal-input-wrap {
  position: relative;
  display: grid;
  align-items: baseline;
  flex: 1 1 auto;
  min-width: 0;
}

.terminal-ghost,
.terminal-input-wrap input {
  grid-area: 1 / 1;
}

.terminal-ghost {
  display: block;
  min-height: 0;
  height: 1.35em;
  overflow: hidden;
  color: var(--ghost-text);
  white-space: pre;
  pointer-events: none;
}

.terminal-input-wrap input {
  display: inline-block;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  height: 1.35em;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  caret-color: var(--text);
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  appearance: none;
  vertical-align: baseline;
  position: relative;
  z-index: 1;
}

.terminal-input-wrap input:focus {
  outline: none;
}

.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;
}

#crop-meta,
#crop-status {
  display: none;
}

.terminal-entry {
  font-family: var(--terminal-mono);
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.terminal-entry + .terminal-entry {
  margin-top: 0;
}

.terminal-entry--command {
  color: var(--text);
}

.terminal-entry--system {
  color: var(--muted);
}

.terminal-entry--error {
  color: var(--error-strong);
}

.terminal-entry--success {
  color: var(--success-strong);
}

.terminal-suggestions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
  margin: 0 0 4px;
  padding: 6px 8px;
  border: 1px solid var(--suggestion-border);
  background: var(--terminal-surface);
}

.terminal-suggestions.is-hidden {
  display: none;
}

.terminal-suggestion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  min-width: 0;
  padding: 2px 6px;
  border-radius: 2px;
  color: var(--suggestion-text);
}

.terminal-suggestion.is-selected {
  background: var(--accent-soft-strong);
  color: var(--suggestion-selected-text);
}

.terminal-suggestion__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-suggestion.is-selected .terminal-suggestion__name {
  color: var(--suggestion-selected-name-text);
}

.terminal-suggestion__types {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.terminal-suggestion__type-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 1px 6px;
  border-radius: 2px;
  background: var(--type-chip-bg, #5F6784);
  color: #ffffff;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.terminal-suggestion__type-chip--empty {
  background: transparent;
  color: var(--suggestion-type-text);
  padding-right: 0;
  padding-left: 0;
}

.terminal-suggestion.is-selected .terminal-suggestion__types,
.terminal-suggestion.is-selected .terminal-suggestion__match {
  color: var(--suggestion-selected-name-text);
}

.terminal-suggestion__match {
  color: var(--suggestion-match-text);
}

@keyframes terminal-prompt-blink {
  0%,
  54% {
    color: var(--text);
  }

  55%,
  100% {
    color: var(--blink-hidden);
  }
}

@media (max-width: 1080px) {
  body {
    overflow: auto;
  }

  .layout-splitter {
    display: none;
  }

  .workspace-column-splitter {
    display: none;
  }

  .workspace-top {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
      "toolbar"
      "my"
      "live"
      "enemy";
    flex: 0 0 auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .live-panel {
    border-left: 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .video-stage {
    width: 100%;
    max-height: none;
  }

  .crop-preview-shell {
    min-height: 220px;
  }

  .terminal-panel {
    flex-basis: 260px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .live-panel,
  .crop-panel,
  .workspace-toolbar {
    padding: 12px;
  }

  .terminal-output {
    margin: 0 12px 12px;
  }

  .terminal-suggestions {
    padding-inline: 6px;
  }

  .workspace-toolbar {
    flex-wrap: wrap;
  }

  .toolbar-main-controls {
    flex-wrap: wrap;
  }

  .video-stage {
    min-height: 220px;
    width: 100%;
  }

  .crop-preview-shell {
    min-height: 200px;
  }
}
