:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
  background: #ffffff;
  color: #0a0a0a;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  background: #ffffff;
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid #0a0a0a;
  border-radius: 0;
  background: #ffffff;
  color: #0a0a0a;
  cursor: pointer;
  font-weight: 600;
}

button:hover:not(:disabled),
button:focus-visible:not(:disabled) {
  background: #0a0a0a;
  color: #ffffff;
}

button:focus-visible,
.upload-box:focus-visible {
  outline: 2px solid #0a0a0a;
  outline-offset: 3px;
}

button:disabled {
  border-color: #c9c9c9;
  color: #a3a3a3;
  background: #f4f4f4;
  cursor: not-allowed;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100vh;
  padding: 28px 32px 24px;
  gap: 24px;
}

.page-header {
  min-height: 34px;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.upload-view {
  display: grid;
  place-content: center;
  justify-items: center;
  min-height: 420px;
}

.upload-box {
  display: grid;
  place-items: center;
  align-content: center;
  width: min(440px, calc(100vw - 48px));
  min-height: 220px;
  border: 1px solid #0a0a0a;
  background: #ffffff;
  cursor: pointer;
}

.upload-box:hover,
.upload-box.is-dragging {
  background: #0a0a0a;
  color: #ffffff;
}

.upload-title {
  font-size: 18px;
  font-weight: 700;
}

.upload-note {
  margin-top: 8px;
  color: #666666;
  font-size: 13px;
}

.upload-box:hover .upload-note,
.upload-box.is-dragging .upload-note {
  color: #d6d6d6;
}

.error-message {
  max-width: 440px;
  margin: 14px 0 0;
  font-size: 14px;
  text-align: center;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
}

.image-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  margin: 0;
}

figcaption {
  padding: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.image-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid #0a0a0a;
  background-color: #f7f7f7;
  background-image:
    linear-gradient(45deg, #ececec 25%, transparent 25%),
    linear-gradient(-45deg, #ececec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ececec 75%),
    linear-gradient(-45deg, transparent 75%, #ececec 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 210px);
  object-fit: contain;
  background: #ffffff;
}

.image-placeholder {
  padding: 12px;
  background: #ffffff;
  font-size: 13px;
}

.bottom-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  min-height: 54px;
}

.progress-area {
  width: min(420px, 42vw);
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-height: 20px;
  font-size: 13px;
}

.progress-time {
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 8px;
  margin-top: 8px;
  border: 1px solid #0a0a0a;
  background: #ffffff;
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: #0a0a0a;
  transition: width 160ms linear;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 820px) {
  .app-shell {
    min-height: 100dvh;
    padding: 20px 16px 16px;
    gap: 18px;
  }

  .workspace {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .image-frame {
    min-height: 300px;
  }

  .image-frame img {
    max-height: 52vh;
  }

  .bottom-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }

  .progress-area {
    width: 100%;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
