:root {
  color-scheme: light dark;
  --bg: #f6f7f9; --card: #ffffff; --fg: #15171c; --muted: #6b7280; --line: #e6e8ec;
  --accent: #2f6df6; --ok: #16a34a; --bad: #dc2626; --wait: #b45309;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --card: #181b22; --fg: #e8eaf0; --muted: #8b91a1; --line: #262a35; --accent: #4f8cff; --ok: #34d399; --bad: #f87171; --wait: #fbbf24; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
main, .login { max-width: 640px; margin: 0 auto; padding: 16px; }
h1 { margin: 0; font-size: 22px; }
header { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 16px; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:disabled { opacity: .5; }
.link { color: var(--muted); padding: 8px; }
.primary { background: var(--accent); color: #fff; }

.login { margin-top: 18vh; text-align: center; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.login input { font-size: 17px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--fg); }
.login button { padding: 14px; border-radius: 12px; font-weight: 600; }

.actions { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 92px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); font-weight: 600; }
.tile.primary { border-color: transparent; }
.tile .icon { font-size: 26px; line-height: 1; }
.tile.recording { background: var(--bad); color: #fff; border-color: transparent; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .75; } }

.text-form { margin-top: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.text-form textarea { width: 100%; font: inherit; border: 0; resize: vertical; background: transparent; color: var(--fg); outline: none; }
.row { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.small { padding: 8px 18px; border-radius: 10px; font-weight: 600; }

.keep { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; margin: 12px 2px 0; }
.keep input { width: 18px; height: 18px; }
.error { color: var(--bad); font-size: 14px; min-height: 0; margin: 8px 2px 0; }
.error:empty { display: none; }

.dropzone { display: none; }
@media (hover: hover) and (pointer: fine) {
  .dropzone { display: block; margin-top: 12px; border: 2px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }
  .dropzone.active { border-color: var(--accent); color: var(--accent); }
}

.items { list-style: none; padding: 0; margin: 18px 0 40px; display: flex; flex-direction: column; gap: 10px; }
.hint { color: var(--muted); font-size: 13px; margin: 16px 2px 0; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.item.uploading { color: var(--muted); font-size: 14px; }
.item-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.item-title { font-weight: 600; word-break: break-word; }
.item-time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.item-file { color: var(--muted); font-size: 12px; word-break: break-all; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.pill.ok { color: var(--ok); } .pill.bad { color: var(--bad); } .pill.wait { color: var(--wait); } .pill.muted { color: var(--muted); }
details { margin-top: 8px; }
summary { color: var(--accent); font-size: 14px; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: '▸ '; } details[open] summary::before { content: '▾ '; }
.item-summary { white-space: pre-wrap; font-size: 14px; margin-top: 6px; }
.item-reason { color: var(--muted); font-size: 13px; margin-top: 6px; }
.item-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chip { font-size: 14px; padding: 8px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }

@media (min-width: 760px) {
  main { padding-top: 32px; }
  .tile { min-height: 110px; }
}

.login input { text-align: center; letter-spacing: .5em; font-size: 24px; }
