:root {
  color-scheme: light;
  --page: #eef2f0;
  --surface: #fcfdfa;
  --ink: #172721;
  --soft-ink: #4e625a;
  --line: #cad5ce;
  --accent: #1d5644;
  --tint: #e4eee8;
  --error: #92342e;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.workspace {
  width: min(calc(100% - 48px), 930px);
  margin: clamp(42px, 10vh, 110px) auto 48px;
}

.intro { margin-bottom: 32px; }
.intro h1 {
  margin: 0;
  font-size: clamp(42px, 8vw, 76px);
  font-weight: 780;
  line-height: 1.14;
  letter-spacing: -.07em;
}
.intro h1 span { margin-left: .08em; color: var(--accent); }
.intro p {
  margin: 14px 0 0;
  color: var(--soft-ink);
  font-size: 15px;
  line-height: 1.7;
}

.upload {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 36px #17272109;
}
.image-panel { min-width: 0; }

.drop-zone {
  display: grid;
  place-items: center;
  width: 100%;
  height: 258px;
  position: relative;
  overflow: hidden;
  border: 1px dashed #92a89b;
  border-radius: 9px;
  background:
    linear-gradient(to right, #1d56440e 1px, transparent 1px) center / 18px 18px,
    linear-gradient(to bottom, #1d56440e 1px, transparent 1px) center / 18px 18px,
    #edf3ee;
  color: var(--ink);
}
.drop-zone:is(:hover, [data-dragging]) {
  border-color: var(--accent);
  background-color: var(--tint);
}
.drop-prompt { display: grid; justify-items: center; gap: 7px; }
.drop-prompt strong { font-size: 17px; }
.drop-prompt span:last-child { font-size: 13px; color: var(--soft-ink); }

.frame-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 36px;
  margin-bottom: 8px;
  border-radius: 6px;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  background: #f1f6f1;
}
.frame-mark::before {
  content: "+";
  font: 25px/1 var(--mono);
}
#preview {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 10px;
  object-fit: contain;
}

.image-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 11px 2px 2px;
  color: var(--soft-ink);
  font: 12px/1.5 var(--mono);
}
#formats { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#file-size { white-space: nowrap; }

.controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  margin: 4px 0 4px 24px;
  padding: 0 4px 0 24px;
  border-left: 1px solid var(--line);
}
.lifetime-time {
  display: block;
  color: var(--accent);
  font: 600 46px/1 var(--mono);
  letter-spacing: -.07em;
}
.lifetime-time span { font: 650 18px/1.2 system-ui, sans-serif; letter-spacing: 0; }
.lifetime p {
  margin: 12px 0 0;
  max-width: 250px;
  color: var(--soft-ink);
  font-size: 14px;
  line-height: 1.65;
}
.result label { font-size: 14px; font-weight: 680; }
.text-input {
  width: 100%;
  min-width: 0;
  min-height: 43px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
}
.upload-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-top: 16px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: white;
  background: var(--accent);
  font-weight: 680;
  font-size: 14px;
}
.upload-button:disabled { background: #e0e9e2; color: #50675c; }
.upload-button:not(:disabled):hover { background: #143e32; }

.status { min-height: 1.5em; margin: 9px 4px; color: var(--error); font-size: 13px; }
.status[data-success] { color: var(--accent); }
.result {
  background: var(--surface);
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.result-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 9px;
}
#expiry { color: var(--soft-ink); font-size: 12px; }
.result-actions { display: flex; gap: 6px; }
#link { flex: 1; width: auto; font: 13px/1.6 var(--mono); }
.result-actions button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--tint);
  color: var(--ink);
  padding: 8px 12px;
  font-size: 13px;
}
.result-actions button:hover { border-color: var(--accent); }
.result p { margin: 10px 0 0; color: var(--soft-ink); font-size: 13px; }

dialog {
  width: min(420px, calc(100% - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
}
dialog::backdrop { background: #17272166; }
dialog h2 { margin: 0; font-size: 21px; }
dialog p { margin: 12px 0; color: var(--soft-ink); font-size: 14px; line-height: 1.6; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.dialog-actions button {
  min-height: 43px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}
.dialog-actions button[value="compress"] {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

@media (max-width: 660px) {
  .workspace { width: calc(100% - 32px); }
  .intro { margin-bottom: 23px; }
  .upload { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .drop-zone { height: 190px; }
  .controls {
    margin: 15px 0 0;
    padding: 15px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .result-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #link { grid-column: span 2; }
  .result-actions button { min-height: 43px; }
}
