:root {
  --bg: #f6f4ef; --card: #fff; --text: #222; --muted: #777; --line: #ddd8cc;
  --accent: #6b4f2a; --accent-text: #fff; --warn: #fff3cd; --danger: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1b1a18; --card: #262522; --text: #eee; --muted: #999; --line: #3a3833;
          --accent: #c9a46a; --accent-text: #1b1a18; --warn: #4a3f1c; --danger: #ff8a80; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 16px/1.6 -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
.view, header, .banner { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 12px 0; }
.narrow { max-width: 380px; width: calc(100% - 32px); margin: 15vh auto 0; }
h1 { font-size: 22px; margin: 0 0 12px; }
label { display: block; margin: 8px 0; }
input, select, textarea { width: 100%; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
textarea { resize: vertical; line-height: 1.7; }
button, .button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.danger { color: var(--danger); margin-left: auto; }
.link { border: 0; background: none; padding: 4px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.row.wrap { flex-wrap: wrap; }
.row input { flex: 1; }
.row select { width: auto; }
.title { font-size: 18px; font-weight: 600; }
.tag { font-size: 13px; padding: 2px 10px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.lbl { font-weight: 600; display: block; margin-bottom: 4px; }
.muted { color: var(--muted); font-size: 14px; }
.msg { color: var(--danger); min-height: 1.5em; }
header { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 12px; padding-bottom: 4px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; margin-right: auto; }
.balance { font-size: 14px; }
.banner { font-size: 14px; color: var(--muted); margin-top: 4px; }
.banner.warn { background: var(--warn); color: var(--text); padding: 10px 16px; max-width: none; margin: 0; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--muted); font-size: 14px; }
details textarea { margin-top: 8px; }
.result { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; min-height: 80px; max-height: 60vh; overflow-y: auto; }
#works { list-style: none; padding: 0; }
#works li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; }
#works a { display: flex; gap: 8px; align-items: center; padding: 12px 16px; color: var(--text); text-decoration: none; }
#works .t { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) {
  #f-new { flex-wrap: wrap; }
  #f-new input { flex-basis: 100%; }
}
