:root {
  --bg: #f5eccb;
  --surface: rgba(255, 251, 242, 0.88);
  --surface-strong: rgba(255, 253, 247, 0.98);
  --surface-muted: rgba(154, 111, 45, 0.08);
  --border-soft: rgba(74, 48, 21, 0.12);
  --border-strong: rgba(74, 48, 21, 0.18);
  --text: #2c1c0c;
  --text-muted: #6a4a2b;
  --shadow-soft: 0 8px 22px rgba(94, 72, 32, 0.12);
  --shadow-raised: 0 12px 30px rgba(94, 72, 32, 0.18);
  --mono: 'DM Mono', monospace;
  --serif: 'Playfair Display', serif;
  --accent: #ef476f;
  --accent-two: #f9a826;
  --button: #7c6ee6;
  --radius-card: 28px;
  --radius-surface: 20px;
  --radius-segment: 16px;
  --transition-fast: 140ms ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--mono);
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,0.6) 0, rgba(255,255,255,0) 35%),
    radial-gradient(circle at 80% 10%, rgba(255,255,255,0.45) 0, rgba(255,255,255,0) 28%),
    var(--bg);
}

button,
input,
textarea,
select {
  font: inherit;
}

textarea {
  width: 100%;
  min-width: 0;
  min-height: 140px;
  resize: vertical;
  padding: 16px 18px;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-surface);
  color: var(--text);
  line-height: 1.45;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

textarea::placeholder {
  color: rgba(44, 28, 12, 0.48);
}

textarea:focus {
  outline: none;
  border-color: rgba(124, 110, 230, 0.55);
  box-shadow: 0 0 0 4px rgba(124, 110, 230, 0.14);
}

.page {
  max-width: 1060px;
  margin: 0 auto;
  padding: 56px 24px 96px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius-card);
  padding: 28px;
  backdrop-filter: blur(5px);
}

.card > * + * {
  margin-top: 16px;
}

h1, h2 {
  margin: 0;
  text-align: center;
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

h1 { font-size: clamp(3rem, 7vw, 4.8rem); }
h2 { font-size: clamp(2.4rem, 5.2vw, 4rem); }

.card > h1,
.card > h2 {
  margin-bottom: 12px;
}

.input-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.is-hidden {
  display: none;
}

.json-toggle-wrap {
  display: flex;
  justify-content: flex-start;
}

.json-toggle {
  min-height: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(106, 74, 43, 0.72);
  font-size: 0.92rem;
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: rgba(106, 74, 43, 0.26);
  text-underline-offset: 0.16em;
}

.json-toggle:hover {
  transform: none;
  box-shadow: none;
  background: transparent;
  color: rgba(106, 74, 43, 0.94);
}

.json-toggle:active {
  transform: none;
  box-shadow: none;
}

.input-wrap label {
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.input-row {
  display: flex;
  align-items: stretch;
  gap: 14px;
  width: 100%;
}

input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 16px 18px;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-surface);
  color: var(--text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

input[type="text"]::placeholder {
  color: rgba(44, 28, 12, 0.48);
}

input[type="text"]:focus {
  outline: none;
  border-color: rgba(124, 110, 230, 0.55);
  box-shadow: 0 0 0 4px rgba(124, 110, 230, 0.14);
}

button {
  min-height: 56px;
  padding: 0 22px;
  border: 1px solid rgba(88, 73, 198, 0.26);
  border-radius: var(--radius-surface);
  background: var(--button);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-raised);
  background: #7262e3;
}

button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-soft);
}

.status {
  min-height: 1.25rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.45;
}

.metrics {
  display: flex;
  justify-content: center;
}

.metric {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  max-width: 920px;
  padding: 18px 20px;
  border-radius: var(--radius-surface);
  border: 1px solid var(--border-soft);
  background: var(--surface-muted);
  font-size: clamp(0.96rem, 1.6vw, 1.15rem);
  line-height: 1.45;
  text-align: center;
}

.bubble-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 9px 13px;
  border-radius: 15px;
  color: #fff;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(0,0,0,0.10);
}

.bubble-number.hot { background: var(--accent); }
.bubble-number.sun { background: var(--accent-two); }

.legend {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 14px;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 4px 0;
}

.row-main {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.row-copy {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.pill,
.metric,
.tag {
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  background: var(--surface-strong);
}

.pill {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 24px;
  color: var(--text);
  font-size: 1.08rem;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.pill .dot {
  margin: 0 2px;
  color: rgba(44, 28, 12, 0.55);
}

.segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border-radius: var(--radius-segment);
  font-weight: 600;
  line-height: 1;
  min-height: 48px;
}

.segment-toggle {
  cursor: pointer;
  transform-origin: center;
}

.segment-toggle:hover {
  animation: wobble 420ms ease-in-out;
}

@keyframes wobble {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(-0.9deg); }
  50% { transform: rotate(0.9deg); }
  75% { transform: rotate(-0.6deg); }
  100% { transform: rotate(0deg); }
}

.actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  color: #fff;
  font-size: 1.18rem;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.action--create { background: #27ae60; }
.action--read { background: #2d89c8; }
.action--update { background: #f0a11f; }
.action--delete { background: #cb4837; }
.action--any,
.action--call { background: #8e44ad; }

.favicon-wrap {
  width: 38px;
  height: 38px;
  min-width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
}

.favicon {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transform: scale(0.96);
  transform-origin: center;
  mix-blend-mode: multiply;
  background: transparent;
}

.warning-scope {
  border-color: rgba(220, 53, 69, 0.42);
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.18), var(--shadow-soft);
}

.has-tooltip {
  position: relative;
}

.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  max-width: min(340px, 72vw);
  width: max-content;
  padding: 10px 12px;
  border-radius: 14px;
  background: #6b5b4b;
  color: #fffdf7;
  box-shadow: var(--shadow-raised);
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity 80ms ease;
}

.has-tooltip:hover::after,
.has-tooltip:focus-visible::after {
  opacity: 1;
}

.tooltip-warning::after {
  background: #dc3545;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.98rem;
  color: var(--text-muted);
}

.muted {
  color: var(--text-muted);
}

.error {
  color: #c0392b;
  font-weight: 600;
}

.hint {
  color: var(--text-muted);
  text-align: center;
  font-size: 0.96rem;
  line-height: 1.5;
}

@media (max-width: 820px) {
  .page {
    padding-inline: 18px;
  }

  .card {
    padding: 22px;
  }

  .row {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 28px 14px 56px;
    gap: 18px;
  }

  .card {
    border-radius: 22px;
    padding: 18px;
  }

  .input-row {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .metric {
    padding: 16px;
  }

  .segment {
    min-height: 44px;
    padding: 10px 14px;
  }

  .action {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .favicon-wrap {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }
}
