/* --- base --- */
:root {
  --bg: #0f1223;
  --card: #171a2e;
  --border: #2a2f4a;
  --text: #e6e8ff;
  --muted: #9aa3c7;
  --accent: #8aa1ff;
  --accent-2: #4de2b3;
  --danger: #ff6b6b;
  --ok: #47d16b;
  --warn: #ffd166;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
button,
input,
select,
textarea {
  font-family: inherit;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial;
  color: var(--text);
  background: radial-gradient(1200px 800px at 80% -10%, #1b1f39, transparent),
    var(--bg);
}

a {
  color: var(--accent);
}
p {
  color: var(--muted);
}

.app-header,
.app-footer {
  max-width: 980px;
  margin: 24px auto;
  padding: 0 16px;
}
.app-header h1 {
  font-size: 1.6rem;
  letter-spacing: 0.01em;
  margin: 0 0 0.5rem;
  font-weight: bold;
}
.sub {
  margin-top: 0.25rem;
}

#container {
  max-width: 980px;
  margin: 0 auto 64px;
  padding: 0 16px;
  display: grid;
  gap: 16px;
}

.card_header {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: bold;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card.mini {
  background: transparent;
}

#report {
  width: 100%;
  color: var(--text);
  background: rgb(14, 17, 34);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  outline: none;
}

.card_text_wrapper {
  margin-bottom: 16px;
}

.card_text {
  margin: 0px;
}

.badge {
  font-size: 0.75rem;
  color: var(--accent-2);
  border: 1px solid var(--accent-2);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.grid.three {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
@media (max-width: 860px) {
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }
}

textarea,
input,
select {
  width: 100%;
  background: #0e1122;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  outline: none;
}
textarea {
  resize: vertical;
}

.label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: #c7cef2;
}

.password {
  position: relative;
}
.icon-btn {
  position: absolute;
  right: 6px;
  top: 6px;
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #11142a;
  color: var(--muted);
}
.icon-btn:hover {
  border-color: #3b4270;
}

button.primary,
button.ghost {
  appearance: none;
  border: 1px solid var(--border);
  background: #141734;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
}
button.primary {
  background: linear-gradient(135deg, #3a41a9, #6a91ff);
  border: none;
}
button.primary:disabled {
  opacity: 0.6;
  cursor: wait;
}
button.ghost:hover {
  border-color: #3b4270;
}

.segmented {
  display: inline-flex;
  background: #0e1122;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}
.segmented__btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.segmented__btn[aria-selected='true'] {
  background: #1a1f3e;
  color: var(--text);
}

.hidden {
  display: none;
}

.code {
  background: #0b0e1e;
  border: 1px dashed #2a2f4a;
  padding: 12px;
  border-radius: 12px;
  overflow: auto;
}
.code.small {
  font-size: 0.85rem;
}

.result {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.kv {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: #0e1122;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  background: #101634;
  border: 1px solid #2b3370;
  padding: 6px 10px;
  border-radius: 999px;
}
.meter {
  height: 8px;
  background: #0e1122;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.meter > b {
  display: block;
  height: 100%;
}
.meter .ok {
  background: linear-gradient(90deg, #59e19b, #c2ffd7);
}
.meter .neg {
  background: linear-gradient(90deg, #ff6b6b, #ffd1d1);
}
.meter .neu {
  background: linear-gradient(90deg, #ffd166, #fff1c1);
}

.hint {
  color: #8d96be;
  font-size: 0.85rem;
  margin: 0.35rem 0 0;
}

/* --- usage limit popup --- */
.popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 24, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}
.popup-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.popup-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 24px 20px;
  max-width: 420px;
  width: 90%;
  color: var(--text);
}
.popup-card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}
.popup-message {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}
.popup-message span {
  font-weight: 600;
  color: var(--accent);
}
.popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* お問い合わせ用ボタン（aタグ） */
.contact-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #3a41a9, #6a91ff);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.contact-button:hover {
  filter: brightness(1.05);
}
