:root {
  color-scheme: light;
  --paper: #f8f7f4;
  --surface: #fff;
  --ink: #20211f;
  --muted: #64655e;
  --line: #dcdad3;
  --accent: #2745c3;
  --accent-hover: #1d369e;
  --radius: 8px;
  font: 16px/1.5 Inter, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.hidden { display: none !important; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner, main { width: min(880px, calc(100% - 48px)); margin-inline: auto; }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 750; letter-spacing: -.045em; }
.site-header nav { display: flex; align-items: center; gap: 24px; font-size: 14px; }
.site-header nav a, .site-header nav button { color: var(--muted); }
.site-header nav button, .text-button { padding: 0; border: 0; background: none; }
.site-header nav a:hover, .site-header nav button:hover { color: var(--ink); }

.lookup { padding: clamp(46px, 8vw, 82px) 0 50px; }
h1 { font-size: clamp(44px, 8vw, 76px); font-weight: 720; line-height: 1.03; letter-spacing: -.075em; }
.lookup > p { color: var(--muted); margin-top: 16px; font-size: clamp(16px, 2vw, 18px); }
.lookup-form { display: flex; gap: 10px; margin-top: 28px; }
.url-field { display: flex; flex: 1; min-width: 0; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.url-field:focus-within { border-color: var(--accent); }
.url-field input { flex: 1; min-width: 0; width: 100%; padding: 14px; border: 0; background: transparent; color: var(--ink); }
.url-field input:focus { outline: none; }
.url-field input::placeholder { color: var(--muted); }
.url-field button { margin-right: 6px; padding: 6px 10px; border: 0; border-radius: 5px; color: var(--accent); background: transparent; font-size: 14px; }
.url-field button:hover { background: #edf0fc; }
.button { min-height: 42px; padding: 8px 14px; border: 1px solid transparent; border-radius: var(--radius); font-weight: 650; }
.primary { color: white; background: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.lookup-form .primary { padding-inline: 24px; }
.secondary { color: var(--ink); border-color: var(--line); background: var(--surface); }
.secondary:hover:not(:disabled) { border-color: var(--ink); }
.form-foot { margin-top: 12px; display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; }
.form-foot, .help, .media-meta, .upload-area small { color: var(--muted); font-size: 13px; }
.text-button { color: var(--accent); font-size: 14px; font-weight: 620; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }

.result { padding: 25px 0 34px; border-top: 1px solid var(--line); scroll-margin-top: 12px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -.035em; }
#resultBadge { color: var(--muted); font-size: 13px; }
.result-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; margin-top: 15px; }
.preview-frame { display: grid; place-items: center; overflow: hidden; aspect-ratio: 16 / 10; border-radius: var(--radius); color: white; background: #212220; }
.preview-frame video { width: 100%; height: 100%; object-fit: contain; }
.preview-empty { font-size: 14px; }
.source p:not(.media-meta) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; color: var(--muted); font-size: 14px; margin-top: 4px; }
.media-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 5px; }
.result-controls { display: grid; align-content: start; gap: 10px; min-width: 0; }
.segmented { display: flex; padding: 3px; gap: 3px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.segment { flex: 1; padding: 7px 5px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 14px; }
.segment.active { background: #e9edfc; color: var(--accent); font-weight: 700; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.settings label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.settings select { min-width: 0; padding: 6px 9px; color: var(--ink); border: 1px solid var(--line); background: var(--surface); border-radius: 6px; }
.media-selector { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.media-chip { padding: 4px 9px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; }
.media-chip.active { border-color: var(--accent); color: var(--accent); }
.whatsapp-actions { display: grid; gap: 7px; }

.tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; padding: 28px 0 54px; border-top: 1px solid var(--line); }
.upload-area { position: relative; display: grid; gap: 3px; padding: 14px; margin: 12px 0 9px; border: 1px dashed #aaa99f; border-radius: var(--radius); background: var(--surface); cursor: pointer; overflow-wrap: anywhere; }
.upload-area input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-area:focus-within, .upload-area:hover, .upload-area.dragging { border-color: var(--accent); background: #edf0fc; }
.history-empty { color: var(--muted); font-size: 14px; padding: 12px 0; }
.history-item { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.history-icon { color: var(--accent); font-size: 11px; font-weight: 700; }
.history-item-text { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.history-item-text small { display: block; color: var(--muted); }
.notice { margin-top: 10px; padding: 8px 12px; color: #861c17; background: #faeae7; border-radius: 5px; font-size: 14px; }

dialog { width: min(440px, calc(100% - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--surface); }
dialog::backdrop { background: #20211f73; }
.modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-heading button { border: 0; background: none; color: var(--ink); font-size: 22px; line-height: 1; }
dialog p { color: var(--muted); font-size: 14px; margin: 10px 0; }
.toast { position: fixed; inset: auto 18px 18px auto; max-width: min(360px, calc(100% - 36px)); padding: 10px 14px; border-radius: var(--radius); background: var(--ink); color: white; font-size: 14px; opacity: 0; pointer-events: none; }
.toast.show { opacity: 1; }

@media (max-width: 640px) {
  .header-inner, main { width: calc(100% - 32px); }
  .header-inner { min-height: 56px; }
  .site-header nav { gap: 14px; }
  .result-layout, .tools { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .lookup-form { display: grid; }
  .lookup-form .primary { min-height: 46px; }
  .tools { padding-bottom: 34px; }
}
