:root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #e8edf4;
  background: #0d1320;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1b2742 0%, #0d1320 55%);
}

.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.card {
  width: min(560px, 100%);
  background: rgba(20, 30, 50, 0.9);
  border: 1px solid rgba(148, 178, 255, 0.25);
  border-radius: 18px;
  padding: 16px;
  backdrop-filter: blur(6px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

h1 {
  font-size: 1.3rem;
  margin: 0;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.sub {
  margin: 6px 0 14px;
  color: #a8b6cf;
  font-size: 0.9rem;
}

.tool-description {
  margin: 0 0 14px;
  color: #a8b6cf;
  font-size: 0.9rem;
  line-height: 1.7;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.hint {
  margin: -2px 0 0;
  color: #91a4c4;
  font-size: 0.78rem;
  line-height: 1.5;
}


h2 {
  font-size: 0.98rem;
  margin: 14px 0 8px;
  color: #d8e4f7;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

label {
  font-size: 0.9rem;
  color: #c8d3e5;
}

input {
  width: 100%;
  border: 1px solid #324869;
  border-radius: 10px;
  padding: 12px;
  font-size: 1rem;
  color: #f4f8ff;
  background: #132035;
}

input:focus {
  outline: 2px solid #5b96ff;
  border-color: transparent;
}

.primary {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2979ff, #5e35ff);
  margin: 10px 0 12px;
}

.primary.compact {
  width: auto;
  min-width: 96px;
  margin: 0;
  padding: 10px 14px;
}

.primary.is-cancel {
  background: linear-gradient(135deg, #cc2f45, #9f2336);
}

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(122, 156, 216, 0.4);
  border-radius: 10px;
  background: rgba(21, 37, 61, 0.75);
  color: #d6e1f3;
  padding: 9px 12px;
  font-weight: 700;
}

.link-button {
  text-decoration: none;
}

.ghost:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.loading-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  border: 1px solid rgba(245, 197, 66, 0.38);
  border-radius: 12px;
  background: rgba(245, 197, 66, 0.1);
  color: #ffe08a;
  font-weight: 700;
}

.loading-panel[hidden] {
  display: none;
}

.loader {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 224, 138, 0.28);
  border-top-color: #ffe08a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid #3a4f70;
  border-radius: 999px;
  background: #15253d;
  color: #d6e1f3;
  padding: 8px 10px;
  font-size: 0.84rem;
}



.chart-scroll {
  margin-top: 14px;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid rgba(122, 156, 216, 0.22);
  border-radius: 12px;
  background: rgba(8, 13, 24, 0.7);
}

.chart {
  display: block;
  width: 100%;
  height: 180px;
}

.result {
  margin-top: 14px;
  min-height: 72px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  background: rgba(8, 13, 24, 0.7);
  border: 1px solid rgba(122, 156, 216, 0.22);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.disclaimer {
  margin: 8px 0 0;
  color: #6f809d;
  font-size: 0.68rem;
  line-height: 1.5;
  text-align: center;
}

.policy-link {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 0;
  text-align: center;
}

.policy-link a,
.policy-link a:visited {
  color: #a8b6cf;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.6;
  text-underline-offset: 2px;
}

@media (max-width: 420px) {
  .grid2,
  .grid3 {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 14px;
    border-radius: 14px;
  }

  h1 {
    font-size: 1.14rem;
  }

  .card-header {
    display: grid;
  }

  .header-actions {
    justify-content: stretch;
  }

  .header-actions > * {
    flex: 1;
  }

  .chip {
    font-size: 0.8rem;
  }
}


.radio-row {
  display: flex;
  gap: 14px;
  margin-bottom: 10px;
}

.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

fieldset {
  border: 1px solid rgba(122, 156, 216, 0.28);
  border-radius: 10px;
  padding: 10px;
  margin: 0 0 10px;
}

fieldset.is-disabled {
  opacity: 0.55;
}

.chart {
  height: 220px;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(5, 8, 14, 0.62);
}

.tutorial-overlay[hidden] {
  display: none;
}

.tutorial-box {
  width: min(100%, 520px);
  border: 1px solid rgba(148, 178, 255, 0.32);
  border-radius: 14px;
  background: #101a2c;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  padding: 16px;
}

.tutorial-box h2 {
  margin: 4px 0 8px;
  font-size: 1.1rem;
}

.tutorial-box p {
  margin: 0;
  color: #c8d3e5;
  line-height: 1.6;
}

.tutorial-step {
  color: #91a4c4;
  font-size: 0.8rem;
  font-weight: 700;
}

.tutorial-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.tutorial-highlight {
  position: relative;
  z-index: 21;
  outline: 3px solid #f5c542;
  outline-offset: 4px;
  border-radius: 10px;
}
