:root {
  --bg: #141820;
  --card: #1c2230;
  --line: #2a3140;
  --text: #f3f4f6;
  --muted: #9aa3b2;
  --accent: #3b82f6;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.5 "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  padding: 16px;
}

body.web:not(.page) {
  max-width: 560px;
  margin: 0 auto;
}

h1 { font-size: 16px; margin: 0 0 6px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.title-row h1 { margin: 0; }
.title-row button { flex: 0; white-space: nowrap; }

.page { max-width: 720px; margin: 0 auto; }
.back-link {
  color: #93c5fd;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}
.toolbar { margin-top: 12px; }
.toolbar button { width: auto; flex: 0; margin: 8px 8px 0 0; }
.save-bar { position: sticky; bottom: 0; padding: 12px 0 8px; background: var(--bg); }
.save-bar .ok { min-height: 18px; font-size: 12px; color: #9aa3b2; margin: 8px 0 0; }
header p, .hint { color: var(--muted); margin: 0 0 14px; }
.hint { font-size: 11px; margin: 6px 0 10px; }

label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin: 10px 0 4px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  padding: 8px;
  font: inherit;
}

.yen-kilo {
  display: flex;
  align-items: center;
  width: 100%;
  background: #161b26;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.yen-kilo:focus-within {
  border-color: var(--accent);
}
.yen-kilo input {
  width: auto;
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  border-radius: 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.yen-kilo input:focus {
  outline: none;
}
.yen-kilo-suffix {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 0 10px 0 0;
  background: none;
  border: 0;
  color: #c5cad3;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}
.yen-kilo-suffix .unit {
  font-size: 12px;
  color: var(--muted);
}

.row { display: flex; gap: 8px; margin-top: 12px; }

button {
  flex: 1;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button.secondary,
a.secondary {
  background: #2a3548;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button.danger { background: #5a2d32; flex: 0; }
button.small { flex: 0; padding: 4px 8px; font-size: 11px; }

.modes { display: flex; gap: 8px; margin-bottom: 12px; }
.mode {
  background: #2a3548;
  color: var(--muted);
}
.mode.on { background: var(--accent); color: #fff; }

.panel, .result, .site {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
  margin: 10px 0 0;
}
.check input { width: auto; margin: 0; }

.status {
  padding: 10px;
  border-radius: 8px;
  background: var(--card);
  color: var(--muted);
  margin-bottom: 12px;
}
.status.error { color: #f0a0a0; }
.status.warn { color: #e2c36b; }

.answer {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}
.answer small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
}

.lines { width: 100%; border-collapse: collapse; }
.lines td { padding: 4px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.lines td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines .note { display: block; font-size: 10px; color: var(--muted); }
.lines tr.total td { font-weight: 700; border-bottom: 0; padding-top: 8px; }

.settings { color: var(--muted); }
.settings summary { cursor: pointer; margin-bottom: 8px; color: var(--text); }

.site h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text);
}
.site-head { display: flex; gap: 8px; align-items: center; }
.site-head input { flex: 1; }

.fee-block { margin-top: 12px; }
.fee-block h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text);
}

.fee-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: #161b26;
}

.inline {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}
.inline input { flex: 1; min-width: 0; }
.inline span { color: var(--muted); font-size: 11px; flex-shrink: 0; }

.band { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  body {
    padding: 12px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  input, select, button, a.secondary, .yen-kilo {
    min-height: 44px;
    font-size: 16px;
  }
  .yen-kilo-suffix .unit { font-size: 13px; }
  button.small { min-height: 36px; }
  .inline { flex-wrap: wrap; }
  .title-row { align-items: flex-start; }
}
