:root {
  --paper: #f7f2e8;
  --paper-deep: #eee7da;
  --ink: #1f2e35;
  --ink-soft: #53626a;
  --green: #203936;
  --green-light: #31534c;
  --coral: #d46b52;
  --coral-dark: #b95743;
  --line: rgba(31, 46, 53, 0.13);
  --white: #fffdf9;
  --shadow: 0 24px 60px rgba(34, 43, 41, 0.1);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 14% 10%, rgba(255, 255, 255, 0.72), transparent 29rem),
    linear-gradient(135deg, rgba(214, 181, 139, 0.1) 25%, transparent 25%) 0 0 / 18px 18px,
    var(--paper);
}

button,
label {
  font: inherit;
}

button,
label,
input {
  -webkit-tap-highlight-color: transparent;
}

button,
label {
  cursor: pointer;
}

button:focus-visible,
label:focus-within {
  outline: 3px solid rgba(212, 107, 82, 0.42);
  outline-offset: 4px;
}

.app-shell {
  width: min(1220px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 30px 0 46px;
}

.topbar,
.brand-lockup,
.topbar-note,
.preview-heading,
.preview-footer,
.upload-status,
.thumb-heading,
.action-row,
.privacy-note {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  margin-bottom: 34px;
}

.brand-lockup {
  gap: 13px;
}

.brand-mark {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 5px);
  align-items: end;
  gap: 3px;
  width: 34px;
  height: 34px;
  padding: 8px 9px;
  border-radius: 11px 11px 7px 7px;
  background: var(--green);
  box-shadow: 4px 4px 0 #c5a67b;
}

.brand-mark::after {
  position: absolute;
  right: 6px;
  bottom: -4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
  background: var(--green);
  content: "";
  transform: rotate(45deg);
}

.brand-mark span {
  display: block;
  border-radius: 4px 4px 1px 1px;
  background: #f1d19b;
}

.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 15px; }
.brand-mark span:nth-child(3) { height: 11px; }

.eyebrow,
.section-kicker,
.step-pill {
  margin: 0;
  color: var(--coral-dark);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.brand-lockup h1 {
  margin: 3px 0 0;
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  letter-spacing: -0.04em;
}

.topbar-note {
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.local-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5f9b7d;
  box-shadow: 0 0 0 4px rgba(95, 155, 125, 0.15);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(360px, 0.97fr);
  gap: clamp(30px, 5vw, 74px);
  align-items: start;
}

.preview-heading {
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 18px;
}

.section-kicker {
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 0.65rem;
}

.preview-heading h2,
.panel-intro h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.1rem);
  line-height: 1.12;
  letter-spacing: -0.065em;
}

.ratio-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid rgba(31, 46, 53, 0.18);
  border-radius: 999px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.ratio-icon {
  display: block;
  width: 10px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.preview-card {
  overflow: hidden;
  border: 1px solid rgba(31, 46, 53, 0.16);
  border-radius: 22px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.preview-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: var(--green);
  isolation: isolate;
}

.classroom-frame,
.clock-overlay,
.screen-mask,
.poster-slot,
.preview-tag {
  position: absolute;
}

.classroom-frame {
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clock-overlay {
  z-index: 4;
  top: 11.7%;
  left: 37.8%;
  display: grid;
  place-items: center;
  width: 21.8%;
  height: 6.2%;
  border-radius: 3px;
  background: #111616;
  color: #fb2326;
  font-family: "Courier New", monospace;
  font-size: clamp(0.72rem, 3.7vw, 2.55rem);
  font-weight: 700;
  letter-spacing: -0.08em;
  line-height: 1;
  text-shadow: 0 0 5px rgba(255, 42, 42, 0.5);
}

.screen-mask {
  z-index: 1;
  top: 27.5%;
  left: 0;
  width: 100%;
  height: 45.1%;
  background:
    linear-gradient(135deg, rgba(68, 109, 93, 0.15), transparent 38%),
    linear-gradient(180deg, #2c4a43, #1e3532 70%, #213d38);
  box-shadow: inset 0 12px 24px rgba(0, 0, 0, 0.16), inset 0 -10px 24px rgba(0, 0, 0, 0.14);
}

.poster-slot {
  z-index: 2;
  top: 27.5%;
  left: 0;
  width: 100%;
  height: 45.1%;
  overflow: hidden;
  background: transparent;
  box-shadow: inset 0 10px 18px rgba(0, 0, 0, 0.1), inset 0 -12px 18px rgba(0, 0, 0, 0.16);
}

.poster-image {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.poster-image.is-visible {
  display: block;
}

.poster-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  height: 100%;
  padding: 20px;
  color: #f1e7d6;
  text-align: center;
}

.poster-empty strong {
  font-size: clamp(0.78rem, 1.5vw, 1rem);
  line-height: 1.35;
}

.poster-empty span:last-child {
  color: rgba(241, 231, 214, 0.68);
  font-size: clamp(0.58rem, 1vw, 0.72rem);
}

.upload-glyph {
  display: grid;
  place-items: center;
  width: clamp(31px, 5vw, 44px);
  height: clamp(31px, 5vw, 44px);
  border: 1px solid rgba(241, 231, 214, 0.6);
  border-radius: 50%;
  color: #f4d097;
}

.upload-glyph svg {
  width: 55%;
  height: 55%;
}

.preview-tag {
  z-index: 3;
  top: 13px;
  left: 15px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 4px;
  background: rgba(23, 39, 36, 0.7);
  color: rgba(255, 248, 236, 0.9);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.preview-footer {
  justify-content: space-between;
  gap: 18px;
  padding: 16px 19px 17px;
}

.footer-label,
.footer-hint {
  display: block;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.preview-footer strong {
  display: block;
  margin-top: 4px;
  font-size: 0.92rem;
}

.footer-hint {
  align-self: end;
  color: var(--coral-dark);
  text-align: right;
}

.preview-tip {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 17px 4px 0;
  color: var(--ink-soft);
}

.tip-line {
  flex: 0 0 auto;
  width: 26px;
  height: 1px;
  margin-top: 10px;
  background: var(--coral);
}

.preview-tip p {
  max-width: 420px;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.6;
}

.control-panel {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: clamp(25px, 4vw, 42px);
  border: 1px solid rgba(31, 46, 53, 0.15);
  border-radius: 26px;
  background: rgba(255, 253, 249, 0.72);
  box-shadow: 0 18px 40px rgba(34, 43, 41, 0.06);
}

.panel-intro {
  margin-bottom: 24px;
}

.step-pill {
  display: inline-block;
  margin-bottom: 14px;
  padding: 7px 9px;
  border-radius: 4px;
  background: #f2dfc0;
  color: var(--coral-dark);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
}

.panel-intro p {
  max-width: 370px;
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.65;
}

.drop-zone {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 176px;
  padding: 24px;
  border: 1.5px dashed rgba(31, 46, 53, 0.32);
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(245, 234, 215, 0.58), rgba(255, 253, 249, 0.7));
  text-align: center;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--coral);
  background: #fff6e9;
  transform: translateY(-2px);
}

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

.drop-icon {
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--green);
  color: #f6d59d;
}

.drop-icon svg {
  width: 24px;
  height: 24px;
}

.drop-title {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
}

.drop-subtitle {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.upload-status {
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--line);
}

.status-count {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.status-count strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.status-format {
  color: var(--coral-dark);
  font-size: 0.73rem;
  font-weight: 700;
}

.thumb-section {
  padding-top: 18px;
}

.thumb-heading {
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 800;
}

.text-button {
  border: 0;
  padding: 5px 0;
  background: transparent;
  color: var(--coral-dark);
  font-size: 0.75rem;
}

.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  min-height: 92px;
}

.thumb-empty {
  display: grid;
  grid-column: 1 / -1;
  place-items: center;
  align-content: center;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(247, 242, 232, 0.6);
  color: var(--ink-soft);
  text-align: center;
}

.thumb-empty span {
  font-size: 0.77rem;
}

.thumb-empty small {
  margin-top: 4px;
  color: #889093;
  font-size: 0.68rem;
}

.thumb-item {
  position: relative;
  min-width: 0;
}

.thumb-button {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 9px;
  background: #e5ded1;
  transition: border-color 160ms ease, transform 160ms ease;
}

.thumb-button:hover {
  transform: translateY(-2px);
}

.thumb-button.is-selected {
  border-color: var(--coral);
}

.thumb-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-index {
  position: absolute;
  right: 5px;
  bottom: 4px;
  min-width: 17px;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(31, 46, 53, 0.7);
  color: white;
  font-size: 0.61rem;
  font-weight: 800;
}

.selected-mark {
  position: absolute;
  top: 5px;
  left: 5px;
  display: none;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--coral);
  color: white;
}

.thumb-button.is-selected .selected-mark {
  display: grid;
}

.selected-mark svg {
  width: 13px;
  height: 13px;
}

.remove-button {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  opacity: 0;
  transition: opacity 160ms ease, transform 160ms ease;
}

.thumb-item:hover .remove-button,
.thumb-item:focus-within .remove-button {
  opacity: 1;
}

.remove-button:hover {
  background: var(--coral-dark);
  transform: scale(1.05);
}

.remove-button svg {
  width: 13px;
  height: 13px;
}

.panel-bottom {
  margin-top: auto;
  padding-top: 28px;
}

.privacy-note {
  gap: 8px;
  margin-bottom: 16px;
  color: var(--ink-soft);
  font-size: 0.71rem;
  line-height: 1.45;
}

.lock-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dfe9df;
  color: #39634d;
}

.lock-icon svg {
  width: 12px;
  height: 12px;
}

.action-row {
  gap: 10px;
}

.secondary-button,
.primary-button {
  min-height: 48px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.secondary-button {
  flex: 0 0 74px;
  border: 1px solid rgba(31, 46, 53, 0.2);
  background: transparent;
  color: var(--ink);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--ink);
  background: rgba(31, 46, 53, 0.05);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff8eb;
}

.primary-button:hover:not(:disabled) {
  background: var(--green-light);
  transform: translateY(-2px);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.primary-button svg {
  width: 18px;
  height: 18px;
}

.success-message {
  min-height: 18px;
  margin: 10px 0 0;
  color: #3e7656;
  font-size: 0.73rem;
  text-align: right;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1.05fr);
    gap: 26px;
  }

  .control-panel {
    padding: 25px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 30px, 560px);
    padding-top: 22px;
  }

  .topbar {
    margin-bottom: 25px;
  }

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

  .preview-column {
    max-width: 560px;
  }

  .control-panel {
    min-height: 0;
  }

  .panel-bottom {
    margin-top: 26px;
  }
}

@media (max-width: 430px) {
  .app-shell {
    width: calc(100% - 22px);
  }

  .topbar-note {
    font-size: 0.72rem;
  }

  .preview-heading h2 {
    font-size: 1.45rem;
  }

  .preview-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .footer-hint {
    align-self: flex-start;
    text-align: left;
  }

  .control-panel {
    padding: 22px 18px;
    border-radius: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
