.anesthesia-workspace {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.anesthesia-header {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line, #d8e0e8);
  border-radius: 12px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 16px 18px;
}

.anesthesia-header h2 {
  color: #173f78;
  font-size: 20px;
  margin: 0 0 5px;
}

.anesthesia-header p,
.anesthesia-empty p,
.anesthesia-image-state p {
  color: #5c6775;
  margin: 0;
}

.anesthesia-upload {
  cursor: pointer;
  flex: 0 0 auto;
  position: relative;
}

.anesthesia-upload input {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.anesthesia-upload:focus-within {
  outline: 2px solid #195a96;
  outline-offset: 2px;
}

.anesthesia-upload.is-disabled {
  cursor: wait;
  opacity: 0.65;
}

.anesthesia-status {
  background: #eef5ff;
  border: 1px solid #cbdcf2;
  border-radius: 8px;
  color: #234f82;
  margin: 0;
  padding: 9px 12px;
}

.anesthesia-status--success {
  background: #edf8f0;
  border-color: #b9dec2;
  color: #236035;
}

.anesthesia-status--error {
  background: #fff1f1;
  border-color: #edc1c1;
  color: #8a2525;
}

.anesthesia-status--warning {
  background: #fff8e8;
  border-color: #ead29a;
  color: #6d4d0d;
}

.anesthesia-empty,
.anesthesia-image-state {
  align-items: center;
  background: #fff;
  border: 1px dashed #b8c6d5;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  min-height: 320px;
  padding: 28px;
  text-align: center;
}

.anesthesia-image-error {
  border-color: #d7afaf;
}

.anesthesia-current {
  background: #fff;
  border: 1px solid var(--line, #d8e0e8);
  border-radius: 12px;
  min-width: 0;
  overflow: hidden;
}

.anesthesia-image-button {
  background: #eef2f6;
  border: 0;
  cursor: zoom-in;
  display: block;
  max-height: min(68vh, 920px);
  min-height: 320px;
  overflow: auto;
  padding: 0;
  width: 100%;
}

.anesthesia-image-button img {
  display: block;
  height: auto;
  margin: 0 auto;
  max-width: 100%;
  object-fit: contain;
}

.anesthesia-current-meta {
  align-items: center;
  color: #5c6775;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  min-height: 48px;
  padding: 8px 12px;
}

.anesthesia-current-meta .button {
  margin-left: auto;
}

.anesthesia-image-loading {
  animation: anesthesia-loading 0.9s linear infinite;
  border: 3px solid #d4deea;
  border-radius: 50%;
  border-top-color: #195a96;
  height: 28px;
  width: 28px;
}

@keyframes anesthesia-loading {
  to { transform: rotate(360deg); }
}

.anesthesia-history {
  background: #fff;
  border: 1px solid var(--line, #d8e0e8);
  border-radius: 10px;
  padding: 0 14px;
}

.anesthesia-history summary {
  cursor: pointer;
  font-weight: 650;
  padding: 12px 0;
}

.anesthesia-history ol {
  border-top: 1px solid #e5eaf0;
  list-style-position: inside;
  margin: 0;
  padding: 4px 0;
}

.anesthesia-history li {
  align-items: center;
  border-bottom: 1px solid #edf0f4;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 9px 0;
}

.anesthesia-history li:last-child {
  border-bottom: 0;
}

.anesthesia-version-state {
  color: #517096;
  min-width: 74px;
  text-align: right;
}

.anesthesia-viewer {
  background: rgba(10, 18, 29, 0.96);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  inset: 0;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  position: fixed;
  z-index: 10000;
}

.anesthesia-viewer.hidden {
  display: none;
}

.anesthesia-viewer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding-bottom: 10px;
}

.anesthesia-viewer-canvas {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.anesthesia-viewer-canvas:focus-visible {
  outline: 3px solid #8fc8ff;
  outline-offset: -3px;
}

.anesthesia-viewer-canvas img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
}

.anesthesia-viewer-hint {
  color: #d8e2ef;
  font-size: 12px;
  margin: 8px 0 0;
  text-align: center;
}

@media (max-width: 720px) {
  .anesthesia-header {
    align-items: stretch;
    flex-direction: column;
  }

  .anesthesia-upload {
    justify-content: center;
  }

  .anesthesia-image-button,
  .anesthesia-empty,
  .anesthesia-image-state {
    min-height: 220px;
  }

  .anesthesia-current-meta .button {
    margin-left: 0;
    width: 100%;
  }

  .anesthesia-history li {
    align-items: flex-start;
    flex-direction: column;
  }

  .anesthesia-viewer-toolbar .button {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .anesthesia-image-loading {
    animation: none;
  }
}
