:root {
  color-scheme: dark;
  --ink: #070708;
  --panel: #19191c;
  --key: #303036;
  --paper: #f1efe6;
  --muted: #aaa9a4;
  --red: #e03732;
  --cyan: #25c9d4;
  --yellow: #f1ce3f;
  --green: #42cb71;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: "Courier New", Courier, monospace;
}

.casus-terminal {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 12px 16px 18px;
}

.casus-header,
.casus-footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.casus-header {
  min-height: 54px;
  border-top: 7px solid var(--red);
  border-bottom: 1px solid #4a4a4e;
  padding: 7px 2px 8px;
}

.casus-header h1 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1;
  letter-spacing: 0;
}

.casus-header h1 span { color: var(--red); }

.casus-header nav,
.casus-footer {
  margin: 0;
  color: var(--cyan);
  font-size: 0.72rem;
  letter-spacing: 0;
}

.casus-header nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 12px;
}

.casus-header nav a {
  color: var(--cyan);
  text-decoration: none;
}

.casus-header nav a:hover,
.casus-header nav a:focus-visible,
.casus-header nav a[aria-current="page"] {
  color: var(--yellow);
  outline: none;
}

.terminal-stage {
  border-left: 2px solid var(--red);
  border-right: 2px solid var(--cyan);
  background: #000;
}

.screen-stripe {
  height: 4px;
  background: var(--yellow);
  border-right: 34vw solid var(--red);
}

x-minitel {
  position: relative;
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  text-align: center;
}

x-minitel canvas {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  aspect-ratio: 32 / 25;
  image-rendering: pixelated;
}

x-minitel .minitel-cursor {
  position: absolute;
  inset: 0 auto auto 0;
  pointer-events: none;
}

.minitel-keyboard {
  width: 100%;
  padding: 8px 6px 10px;
  border-top: 4px solid var(--panel);
  background: var(--panel);
}

.minitel-keyboard button {
  min-width: 0;
  height: 2.8rem;
  padding: 0 3px;
  border: 2px solid var(--panel);
  border-radius: 2px;
  background: var(--key);
  color: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.68rem;
  line-height: 1.05;
  text-shadow: none;
  overflow-wrap: anywhere;
}

.minitel-keyboard button:hover,
.minitel-keyboard button:focus-visible {
  border-color: var(--cyan);
  outline: none;
}

.minitel-keyboard button:active { background: #4b4b53; }
.minitel-keyboard .special button { background: #49494f; }
.minitel-keyboard .send button { background: var(--yellow); color: #111; }
.minitel-keyboard .switch button { background: var(--red); }

.form-config {
  padding: 8px;
  color: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
}

.casus-footer {
  min-height: 34px;
  align-items: center;
  border-bottom: 7px solid var(--red);
  padding: 7px 2px;
}

.status-light {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  background: var(--green);
  box-shadow: 0 0 0 1px #0b652b;
}

@media (max-width: 520px) {
  .casus-terminal { padding: 8px 8px 12px; }
  .casus-header { min-height: 46px; }
  .casus-header h1 { font-size: 1.2rem; }
  .casus-header nav { max-width: 55%; font-size: 0.58rem; }
  .minitel-keyboard { padding: 5px 2px 7px; }
  .minitel-keyboard button { height: 2.45rem; border-width: 1px; font-size: 0.56rem; }
  .casus-footer { font-size: 0.58rem; }
}

.workshop-page,
.admin-page {
  min-height: 100vh;
  background: #0b0b0d;
}

.workshop-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 18px;
  border-top: 7px solid var(--red);
  border-bottom: 1px solid #45454a;
  background: #111114;
}

.workshop-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.workshop-header h1 span { color: var(--red); }

.workshop-header h1 small {
  margin-left: 10px;
  color: var(--yellow);
  font-size: 0.72rem;
  font-weight: normal;
}

.workshop-header nav {
  display: flex;
  gap: 16px;
  font-size: 0.72rem;
}

.workshop-header a {
  color: var(--cyan);
  text-decoration: none;
}

.workshop-header a:hover,
.workshop-header a:focus-visible,
.workshop-header a[aria-current="page"] {
  color: var(--yellow);
  outline: none;
}

.workshop-layout {
  min-height: calc(100vh - 58px);
  display: grid;
  grid-template-columns: minmax(640px, 1fr) minmax(300px, 360px);
}

.editor-stage {
  min-width: 0;
  border-right: 2px solid var(--cyan);
  background: #000;
}

.editor-stage iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 58px);
  border: 0;
  background: #fff;
}

.submission-panel {
  padding: 16px;
  background: #19191c;
  overflow-y: auto;
}

.panel-heading,
.review-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 4px solid var(--red);
  color: var(--yellow);
  font-size: 0.78rem;
}

.panel-heading strong {
  color: var(--green);
  font-size: 0.58rem;
}

.submission-panel form {
  display: grid;
  gap: 6px;
  padding-top: 14px;
}

.submission-panel label,
.admin-login label {
  margin-top: 7px;
  color: var(--cyan);
  font-size: 0.68rem;
}

.submission-panel input,
.submission-panel select,
.submission-panel textarea,
.admin-login input,
.review-toolbar select {
  width: 100%;
  min-height: 36px;
  border: 1px solid #57575e;
  border-radius: 3px;
  background: #0e0e10;
  color: var(--paper);
  padding: 7px 8px;
  font: inherit;
}

.submission-panel textarea { resize: vertical; }

.submission-panel input:focus,
.submission-panel select:focus,
.submission-panel textarea:focus,
.admin-login input:focus {
  border-color: var(--yellow);
  outline: 1px solid var(--yellow);
}

.rights-check {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 8px;
  color: var(--muted) !important;
  line-height: 1.3;
}

.rights-check input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.submission-panel button,
.admin-login button,
.review-toolbar button,
.row-actions button {
  min-height: 36px;
  border: 0;
  border-radius: 3px;
  background: var(--yellow);
  color: #111;
  padding: 8px 10px;
  font: bold 0.72rem "Courier New", monospace;
  cursor: pointer;
}

.submission-panel button { margin-top: 10px; }

.submission-panel button:hover,
.submission-panel button:focus-visible,
.admin-login button:hover,
.admin-login button:focus-visible,
.row-actions button:hover,
.row-actions button:focus-visible {
  background: var(--cyan);
  outline: none;
}

#submission-status,
#admin-status {
  display: block;
  min-height: 34px;
  padding-top: 10px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
}

#submission-status.success { color: var(--green); }
#submission-status.error { color: #ff746f; }

.admin-layout {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0;
}

.admin-login {
  width: min(380px, 100%);
  display: grid;
  gap: 7px;
}

.admin-login button { margin-top: 12px; }

.review-toolbar h2 {
  margin: 0;
  font-size: 0.95rem;
}

.review-toolbar select { width: auto; min-width: 150px; }
.review-toolbar button { width: 38px; padding: 0; font-size: 1.1rem; }
.review-table-wrap { overflow-x: auto; }

.review-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.72rem;
}

.review-table-wrap th,
.review-table-wrap td {
  padding: 9px 8px;
  border-bottom: 1px solid #3d3d42;
  text-align: left;
  vertical-align: top;
}

.review-table-wrap th { color: var(--cyan); }
.review-table-wrap td small { display: block; margin-top: 3px; color: var(--muted); }
.row-actions { display: flex; gap: 5px; }
.row-actions button { width: 34px; min-height: 32px; padding: 0; font-size: 1rem; }
.row-actions button[data-action="rejected"] { background: var(--red); color: white; }

@media (max-width: 980px) {
  .workshop-layout { display: block; }
  .editor-stage { border-right: 0; border-bottom: 2px solid var(--cyan); }
  .editor-stage iframe { height: 72vh; min-height: 560px; }
  .submission-panel { overflow: visible; }
}

@media (max-width: 560px) {
  .workshop-header { align-items: flex-start; padding: 8px 10px; }
  .workshop-header h1 { font-size: 1rem; }
  .workshop-header h1 small { display: block; margin: 4px 0 0; }
  .workshop-header nav { flex-wrap: wrap; justify-content: flex-end; gap: 6px 10px; font-size: 0.62rem; }
  .editor-stage iframe { min-height: 500px; }
  .review-toolbar { align-items: flex-start; flex-wrap: wrap; }
}
