:root {
  --tunturi-green: #42a61d;
  --ink: #15171b;
  --muted: #6f7480;
  --line: #dedfe3;
  --soft-line: #eceef1;
  --panel: #ffffff;
  --surface: #f5f6f7;
  --surface-strong: #ebecef;
  --danger: #c83232;
  font-family: "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 68px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  width: 100%;
  max-width: 1500px;
  height: 100%;
  margin: 0 auto;
  padding: 0 54px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: white;
  border-radius: 11px;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1;
}

.brand-word {
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-style: italic;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar h1 span {
  color: var(--muted);
  font-weight: 500;
}

.topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.topbar nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar nav button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #454a55;
  font-weight: 700;
}

.topbar nav button:hover,
.topbar nav button.active {
  border-color: var(--soft-line);
  background: #f4f5f6;
  color: #20252d;
}

.history-nav-button span {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef7ea;
  color: #2b7813;
  font-size: 11px;
}

.topbar nav .logout-nav-button {
  border-color: rgba(200, 50, 50, 0.2);
  background: #fff5f5;
  color: var(--danger);
}

.topbar nav .logout-nav-button:hover {
  border-color: rgba(200, 50, 50, 0.34);
  background: #ffecec;
  color: #a32626;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(66, 166, 29, 0.12), transparent 30%),
    var(--surface);
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(28, 31, 36, 0.12);
}

.compact-auth-card {
  width: auto;
  grid-auto-flow: column;
  align-items: center;
  padding: 20px 22px;
}

.auth-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand-row h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1;
}

.auth-brand-row h1 span {
  color: var(--muted);
  font-weight: 500;
}

.auth-brand-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.auth-fields {
  display: grid;
  gap: 13px;
}

.auth-error {
  margin: 0;
}

.auth-submit {
  width: 100%;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 520px) minmax(0, 1fr);
  gap: 30px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 32px 54px 54px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.mode-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  border: 0;
  color: #49515b;
  background: transparent;
  border-radius: 10px;
  font-weight: 700;
}

.mode-tabs button.active {
  background: white;
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(18, 22, 28, 0.08);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 10px 26px rgba(28, 31, 36, 0.06);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  margin: 0;
  font-size: 18px;
  white-space: nowrap;
}

.panel-header-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.compact-icon-action {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: #303641;
}

.compact-icon-action:hover {
  border-color: rgba(66, 166, 29, 0.38);
  background: #f4fbf1;
  color: var(--tunturi-green);
}

.compact-icon-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.upload-tile {
  position: relative;
  min-height: 104px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed #d8dbe1;
  border-radius: 12px;
  background: #fafafa;
  color: #9aa0ab;
  overflow: hidden;
}

.upload-tile span {
  max-width: 100%;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  color: #555c66;
  overflow-wrap: anywhere;
}

.upload-tile.has-image {
  border-style: solid;
  border-color: rgba(66, 166, 29, 0.45);
  background: #f6fbf4;
}

.upload-tile img {
  width: 100%;
  height: 74px;
  object-fit: contain;
}

.remove-chip {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: #4a4f58;
}

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #3c424c;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #d9dce2;
  border-radius: 10px;
  background-color: #fbfbfc;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f7480' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(66, 166, 29, 0.7);
  box-shadow: 0 0 0 3px rgba(66, 166, 29, 0.12);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.field-grid.compact {
  grid-template-columns: 1.2fr 0.8fr;
}

.field-grid.single {
  grid-template-columns: 1fr;
}

.choice-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.choice-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice-grid.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.choice-grid button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfbfc;
  color: #464d57;
  font-weight: 700;
}

.choice-grid button.active {
  border-color: var(--tunturi-green);
  background: #f2fbef;
  color: #286c13;
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.model-card {
  position: relative;
  display: grid;
  gap: 9px;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 9px;
  background: #f7f8f9;
  text-align: left;
}

.model-card.active {
  border-color: var(--tunturi-green);
  background: #f3fbef;
}

.model-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: top;
  border-radius: 9px;
  background: white;
}

.model-card strong,
.scene-card strong {
  display: block;
  font-size: 13px;
}

.model-card span {
  color: var(--muted);
  font-size: 11px;
}

.model-card svg {
  position: absolute;
  top: 10px;
  right: 10px;
  color: var(--tunturi-green);
  fill: white;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.segmented button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  color: #525965;
  font-weight: 700;
}

.segmented button.active {
  border-color: var(--tunturi-green);
  background: #f2fbef;
  color: #286c13;
}

.scene-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.scene-card {
  display: grid;
  gap: 9px;
  align-content: start;
  min-height: 140px;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 9px;
  background: #f7f8f9;
  text-align: left;
}

.scene-card.active {
  border-color: var(--tunturi-green);
  background: #f3fbef;
}

.scene-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 9px;
  background: white;
}

.upload-scene {
  align-content: center;
  justify-items: center;
  text-align: center;
  color: #7e8490;
}

.upload-scene img {
  align-self: center;
}

.exercise-layout {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 14px;
}

.exercise-reference {
  min-height: 188px;
  border: 2px dashed #d8dbe1;
  border-radius: 14px;
  background: #fafafa;
  color: #9aa0ab;
  overflow: hidden;
}

.exercise-reference.has-image {
  border-style: solid;
  border-color: rgba(66, 166, 29, 0.45);
}

.exercise-reference img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: white;
}

.exercise-fields {
  display: grid;
  gap: 12px;
}

.bulk-area {
  display: grid;
  gap: 12px;
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: white;
  color: #303641;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
}

.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.analyze-action {
  justify-content: center;
}

.bulk-list {
  display: grid;
  gap: 10px;
  max-height: 530px;
  overflow: auto;
  padding-right: 4px;
}

.bulk-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 150px;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid rgba(66, 166, 29, 0.18);
  border-radius: 999px;
  background: #f2fbef;
  color: #286c13;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-row {
  display: grid;
  place-items: center;
  min-height: 94px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-weight: 700;
}

.bulk-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 34px;
  grid-template-rows: auto minmax(46px, auto);
  gap: 10px;
  align-items: start;
  padding: 10px;
  background: #f8f9fa;
  border: 1px solid var(--soft-line);
  border-radius: 13px;
}

.bulk-row > img {
  grid-row: 1 / span 2;
  width: 86px;
  height: 108px;
  object-fit: contain;
  background: white;
  border-radius: 9px;
  border: 1px solid var(--soft-line);
}

.bulk-title-input {
  grid-column: 2;
  grid-row: 1;
}

.bulk-notes-field {
  grid-column: 2 / 4;
  grid-row: 2;
  min-height: 46px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: #555c66;
}

.danger-icon-button {
  grid-column: 3;
  grid-row: 1;
  border-color: rgba(200, 50, 50, 0.22);
  background: #fff8f8;
  color: var(--danger);
}

.danger-icon-button:hover {
  background: #ffecec;
  border-color: rgba(200, 50, 50, 0.36);
}

.generate-button {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  border: 0;
  border-radius: 12px;
  background: var(--tunturi-green);
  color: white;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(66, 166, 29, 0.24);
}

.generate-button:disabled {
  opacity: 0.48;
  box-shadow: none;
}

.spin {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-box {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 13px 14px;
  border: 1px solid rgba(200, 50, 50, 0.18);
  border-radius: 12px;
  background: #fff5f5;
  color: var(--danger);
  font-weight: 700;
  font-size: 13px;
}

.result-panel {
  position: sticky;
  top: 92px;
  min-height: calc(100vh - 124px);
  align-self: start;
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(28, 31, 36, 0.07);
  overflow: hidden;
}

.result-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--soft-line);
}

.result-header h2 {
  margin: 0;
  font-size: 18px;
}

.result-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-pill {
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef7ea;
  color: #2b7813;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.dry {
  background: #fff3d8;
  color: #8a5a00;
}

.result-body {
  min-height: 600px;
  background: #f2f3f5;
  padding: 26px;
}

.empty-state {
  min-height: 520px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  margin: 18px 0 8px;
  color: var(--ink);
  font-size: 18px;
}

.empty-state p {
  max-width: 360px;
  margin: 0;
  line-height: 1.5;
}

.empty-state .loading-sentence {
  min-height: 24px;
  color: #58606c;
  font-weight: 700;
}

.camera-box,
.loader-ring {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: white;
  border: 1px solid var(--line);
  color: #c4c8cf;
  box-shadow: 0 8px 20px rgba(28, 31, 36, 0.08);
}

.loader-ring {
  color: var(--tunturi-green);
}

.job-list {
  display: grid;
  gap: 16px;
}

.run-message,
.job-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.run-message {
  padding: 12px 14px;
  color: #454c56;
  font-weight: 700;
}

.job-card {
  padding: 16px;
}

.base-card {
  border-color: rgba(66, 166, 29, 0.28);
  background: linear-gradient(180deg, #fbfff9 0%, #ffffff 72%);
}

.job-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.job-card h3 {
  margin: 0;
  font-size: 16px;
}

.job-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.job-error {
  color: var(--danger);
  font-weight: 700;
}

.image-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.base-result {
  grid-template-columns: minmax(230px, 420px);
}

.image-result {
  display: grid;
  gap: 9px;
}

.image-preview-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #eef0f2;
  cursor: zoom-in;
}

.image-preview-button img,
.image-result > img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--soft-line);
}

.image-preview-button img {
  display: block;
  transition: transform 160ms ease, filter 160ms ease;
}

.image-preview-button:hover img {
  transform: scale(1.015);
  filter: brightness(0.92);
}

.preview-overlay {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(18, 22, 28, 0.74);
  color: white;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.image-preview-button:hover .preview-overlay,
.image-preview-button:focus-visible .preview-overlay {
  opacity: 1;
  transform: translateY(0);
}

.image-result a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #f4f5f6;
  color: #303641;
  font-weight: 700;
  text-decoration: none;
}

.prompt-details summary {
  cursor: pointer;
  color: #303641;
  font-weight: 700;
}

.prompt-details pre {
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  border-radius: 12px;
  background: #15171b;
  color: #f5f6f7;
  line-height: 1.5;
  white-space: pre-wrap;
  font-size: 12px;
}

.compact-error {
  margin-bottom: 12px;
}

.history-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  justify-content: flex-end;
  background: rgba(18, 22, 28, 0.22);
  backdrop-filter: blur(4px);
}

.history-panel {
  width: min(440px, 100%);
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 22px;
  border-left: 1px solid var(--line);
  background: white;
  box-shadow: -18px 0 46px rgba(18, 22, 28, 0.16);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.history-header h2 {
  margin: 0;
  font-size: 20px;
}

.history-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.history-empty {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  min-height: 280px;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.history-empty svg {
  color: var(--tunturi-green);
}

.history-empty strong {
  color: var(--ink);
}

.history-empty span {
  max-width: 280px;
  font-size: 12px;
  line-height: 1.45;
}

.history-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.history-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfbfc;
}

.history-card-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.history-card-main img,
.history-placeholder {
  width: 90px;
  height: 62px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: white;
}

.history-card-main img {
  object-fit: cover;
}

.history-placeholder {
  display: grid;
  place-items: center;
  color: #a5abb4;
}

.history-card-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.history-card-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-card-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-delete {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  align-self: start;
  border: 1px solid rgba(200, 50, 50, 0.18);
  border-radius: 10px;
  background: #fff5f5;
  color: var(--danger);
}

.history-delete:hover {
  background: #ffecec;
}

.history-clear {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f4f5f6;
  color: #303641;
  font-weight: 700;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(14, 17, 22, 0.84);
  backdrop-filter: blur(8px);
}

.lightbox-shell {
  width: min(1180px, 100%);
  max-height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
}

.lightbox-header,
.lightbox-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: white;
}

.lightbox-header h3 {
  margin: 0;
  font-size: 18px;
}

.lightbox-header p,
.lightbox-actions span {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.lightbox-icon-button,
.lightbox-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.11);
  color: white;
  cursor: pointer;
}

.lightbox-icon-button {
  width: 40px;
  height: 40px;
  border-radius: 999px;
}

.lightbox-stage {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-stage img {
  max-width: 100%;
  max-height: calc(100vh - 176px);
  object-fit: contain;
  border-radius: 12px;
  background: white;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 58px;
  border-radius: 999px;
  transform: translateY(-50%);
}

.lightbox-nav.previous {
  left: 12px;
}

.lightbox-nav.next {
  right: 12px;
}

.lightbox-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: white;
  color: #20252d;
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: auto;
    min-height: 68px;
  }

  .topbar-inner {
    flex-wrap: wrap;
    padding: 10px 16px;
  }

  .topbar nav {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .workspace {
    padding: 20px 16px 32px;
  }

  .product-grid,
  .model-grid,
  .scene-grid,
  .field-grid,
  .exercise-layout,
  .exercise-layout {
    grid-template-columns: 1fr;
  }

  .lightbox {
    padding: 14px;
  }

  .lightbox-shell {
    max-height: calc(100vh - 28px);
  }

  .lightbox-stage img {
    max-height: calc(100vh - 158px);
  }

  .lightbox-nav {
    width: 38px;
    height: 48px;
  }

  .lightbox-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
