:root {
  --background: #f7f8f5;
  --foreground: #182322;
  --muted: #61726f;
  --line: #dfe6df;
  --panel: #ffffff;
  --teal: #008986;
  --teal-dark: #006b68;
  --amber: #f2a900;
  --ink: #10201f;
  --soft-teal: #e1f3ef;
  --soft-amber: #fff4d4;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  line-break: strict;
  margin: 0;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.topbar {
  align-items: center;
  background: rgba(247, 248, 245, 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 72px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand,
.topbar-cta,
.primary-button,
.secondary-button,
.icon-button {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
}

.brand {
  gap: 10px;
}

.brand-mark {
  background: var(--ink);
  color: #ffffff;
  display: grid;
  height: 38px;
  place-items: center;
  width: 38px;
}

.nav-links {
  color: var(--muted);
  display: flex;
  gap: 26px;
}

.topbar-cta,
.primary-button {
  background: var(--teal);
  color: #ffffff;
  min-height: 44px;
  padding: 0 18px;
}

.secondary-button,
.icon-button {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
  min-height: 44px;
  padding: 0 16px;
}

.danger-button {
  align-items: center;
  background: #fff7f4;
  border: 1px solid #f0c9bd;
  border-radius: 8px;
  color: #c94f33;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
}

body:not([data-view]) .account-section,
body[data-view="landing"] .account-section {
  display: none;
}

body[data-view="login"] .hero,
body[data-view="login"] .workflow-band,
body[data-view="login"] .demo-section,
body[data-view="login"] .feature-grid,
body[data-view="login"] .api-section,
body[data-view="login"] .pricing-section,
body[data-view="login"] .footer,
body[data-view="home"] .hero,
body[data-view="home"] .workflow-band,
body[data-view="home"] .demo-section,
body[data-view="home"] .feature-grid,
body[data-view="home"] .api-section,
body[data-view="home"] .pricing-section,
body[data-view="home"] .footer {
  display: none;
}

body[data-view="login"] .account-status,
body[data-view="home"] #register-form,
body[data-view="home"] #login-form,
body[data-view="home"] .auth-message,
body[data-view="home"] .recovery-panel {
  display: none;
}

body[data-view="login"] .account-section,
body[data-view="home"] .account-section {
  min-height: calc(100vh - 82px);
  padding: 42px clamp(16px, 3vw, 48px) 0;
}

body[data-view="login"] .account-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-view="home"] .account-layout {
  grid-template-columns: minmax(0, 1fr);
}

body[data-view="home"] .account-status {
  margin: 0;
  max-width: none;
}

body[data-view="home"] .section-heading {
  margin-bottom: 18px;
  max-width: 1320px;
}

.home-workspace {
  display: none;
}

body[data-view="home"] .home-workspace {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns:
    minmax(170px, 0.18fr)
    minmax(280px, 0.3fr)
    minmax(0, 0.52fr);
  margin: 0 auto;
  max-width: 1320px;
}

.home-account-slot,
.home-input-slot,
.home-output-slot,
.home-history-slot {
  min-width: 0;
}

.home-history-slot {
  grid-column: 1 / -1;
}

body[data-view="home"] .account-status,
body[data-view="home"] .input-panel,
body[data-view="home"] .result-panel {
  height: 100%;
}

body[data-view="home"] .history-panel {
  margin-top: 0;
  max-width: none;
}

body[data-view="home"] .account-status {
  gap: 12px;
  padding: 18px;
}

body[data-view="home"] .account-status h3 {
  font-size: 1rem;
}

body[data-view="home"] .account-status dl {
  gap: 8px;
}

body[data-view="home"] .account-status dl div {
  align-items: start;
  display: grid;
  gap: 4px;
}

body[data-view="home"] .account-status dd {
  font-size: 0.88rem;
  text-align: left;
}

body[data-view="home"] .usage-meter {
  grid-template-columns: 1fr;
}

body[data-view="home"] .plan-actions {
  gap: 7px;
}

body[data-view="home"] .plan-actions .primary-button,
body[data-view="home"] .plan-actions .secondary-button,
body[data-view="home"] .account-status > .primary-button,
body[data-view="home"] .account-status > .secondary-button,
body[data-view="home"] .account-status > .danger-button {
  min-height: 40px;
  padding: 0 10px;
}

.hero {
  display: grid;
  gap: clamp(28px, 4vw, 54px);
  grid-template-columns: minmax(0, 0.82fr) minmax(320px, 1.18fr);
  padding: clamp(56px, 7vw, 96px) clamp(20px, 5vw, 72px) 38px;
}

.hero-copy {
  align-self: center;
  max-width: 660px;
}

.eyebrow,
.section-kicker {
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 900;
  margin: 0;
  text-transform: uppercase;
}

.hero h1 {
  color: var(--ink);
  font-size: clamp(2.55rem, 4.8vw, 5rem);
  line-height: 1.05;
  margin: 20px 0 22px;
}

.hero-lead,
.panel-note,
.source-note,
.api-copy p,
.feature-grid p {
  color: var(--muted);
  line-height: 1.75;
  text-wrap: pretty;
}

.source-note {
  font-size: 0.78rem;
  margin-bottom: 0;
}

.source-note a {
  color: var(--teal-dark);
  font-weight: 800;
  text-decoration: underline;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

.hero-visual {
  margin: 0;
}

.hero-visual img {
  border: 1px solid rgba(16, 32, 31, 0.09);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(31, 51, 48, 0.18);
  display: block;
  width: 100%;
}

.workflow-band {
  background: var(--ink);
  color: #ffffff;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 34px clamp(20px, 5vw, 72px) 0;
  padding: 18px;
}

.workflow-band span {
  border-left: 3px solid var(--amber);
  padding-left: 10px;
}

.demo-section,
.account-section,
.api-section,
.pricing-section {
  padding: 82px clamp(20px, 5vw, 72px) 0;
}

.section-heading,
.demo-layout,
.api-layout,
.pricing-grid,
.feature-grid {
  margin-left: auto;
  margin-right: auto;
  max-width: 1120px;
}

.section-heading {
  margin-bottom: 28px;
}

.section-heading h2 {
  color: var(--ink);
  font-size: clamp(1.9rem, 3vw, 3rem);
  line-height: 1.18;
  margin: 10px 0 0;
}

.demo-layout,
.api-layout {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
}

.demo-layout > *,
.api-layout > *,
.account-layout > *,
.recovery-grid > *,
.pricing-grid > *,
.feature-grid > * {
  min-width: 0;
}

.history-panel,
.recovery-panel,
.input-panel,
.result-panel,
.account-card,
.api-copy,
.price-card,
.feature-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(28, 43, 40, 0.08);
  padding: 22px;
}

.account-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 1120px;
}

.account-card {
  display: grid;
  gap: 14px;
}

.account-card h3,
.history-panel h3 {
  margin: 0;
}

.account-card label {
  color: var(--ink);
  display: grid;
  font-size: 0.9rem;
  font-weight: 800;
  gap: 7px;
}

.account-card input {
  background: #fbfcf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 44px;
  outline: none;
  padding: 0 14px;
  width: 100%;
}

.account-status dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.account-status dl div {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding-bottom: 10px;
}

.account-status dt {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.account-status dd {
  color: var(--ink);
  font-weight: 850;
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.usage-meter {
  background: var(--soft-teal);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px;
}

.usage-meter span {
  color: var(--teal-dark);
  display: block;
  font-size: 0.78rem;
  font-weight: 850;
}

.usage-meter strong {
  color: var(--ink);
  display: block;
  font-size: 1.12rem;
  margin-top: 4px;
}

.plan-actions {
  display: grid;
  gap: 8px;
}

.history-panel {
  margin: 22px auto 0;
  max-width: 1120px;
}

.recovery-panel {
  margin: 22px auto 0;
  max-width: 1120px;
}

.recovery-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.history-heading {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.history-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.86rem;
  font-weight: 800;
  gap: 10px;
}

.history-item code {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.history-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
}

.history-row {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: 44px minmax(180px, 1fr) minmax(118px, 0.3fr) minmax(118px, 0.3fr);
  min-width: 640px;
  padding: 10px 12px;
}

.history-row:first-child {
  border-top: 0;
}

.history-row-head {
  background: var(--soft-teal);
  color: var(--teal-dark);
  font-size: 0.84rem;
  font-weight: 900;
}

.history-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.input-panel-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.input-panel-heading span {
  background: var(--soft-teal);
  border-radius: 999px;
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 850;
  padding: 5px 10px;
}

.input-panel label,
.checkout-bar label {
  color: var(--ink);
  display: block;
  font-size: 0.9rem;
  font-weight: 800;
}

.address-list {
  display: grid;
  gap: 10px;
}

.address-field {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 34px minmax(0, 1fr) 58px;
}

.field-index {
  background: var(--ink);
  border-radius: 8px;
  color: #ffffff;
  display: grid;
  font-size: 0.86rem;
  font-weight: 850;
  height: 34px;
  place-items: center;
  width: 34px;
}

.address-field input,
.checkout-bar input {
  background: #fbfcf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 44px;
  outline: none;
  padding: 0 14px;
  width: 100%;
}

.remove-address,
.add-address {
  border-radius: 8px;
  font-weight: 800;
}

.remove-address {
  background: #fff7f4;
  border: 1px solid #f0c9bd;
  color: #e76f51;
  min-height: 42px;
}

.add-address {
  background: var(--soft-teal);
  border: 1px solid rgba(0, 137, 134, 0.22);
  color: var(--teal-dark);
  margin-top: 12px;
  min-height: 44px;
  width: 100%;
}

.convert-button {
  margin-top: 10px;
  width: 100%;
}

.panel-title-row {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.panel-title-row .icon-button {
  margin-left: 8px;
}

.result-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 16px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.result-header,
.result-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 58px minmax(180px, 1.3fr) minmax(126px, 0.6fr) minmax(126px, 0.6fr);
  min-width: 720px;
  padding: 12px 14px;
}

.result-header {
  background: var(--soft-teal);
  color: var(--teal-dark);
  font-weight: 900;
}

.result-row {
  border-top: 1px solid var(--line);
  color: #334643;
}

.result-empty {
  color: var(--muted);
  line-height: 1.65;
  padding: 18px;
}

.raw-output,
.compact-output,
.code-panel {
  background: #132523;
  border-radius: 8px;
  color: #e8fff9;
  font-family: "SFMono-Regular", Consolas, monospace;
  line-height: 1.65;
  overflow-x: auto;
  padding: 16px;
}

.feature-grid,
.pricing-grid {
  display: grid;
  gap: 18px;
}

.feature-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pricing-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-grid {
  margin-top: 48px;
  padding: 0 clamp(20px, 5vw, 72px);
}

.api-section {
  background: linear-gradient(180deg, transparent 0, #eef5ef 100%);
  margin-top: 82px;
  padding-bottom: 82px;
}

.pricing-section {
  padding-bottom: 80px;
}

.pricing-intro {
  color: var(--muted);
  line-height: 1.7;
  margin: 0 auto 22px;
  max-width: 1120px;
  text-wrap: pretty;
}

.unit-price-strip,
.checkout-bar {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(28, 43, 40, 0.08);
  display: grid;
  gap: 12px;
  margin: 0 auto 18px;
  max-width: 1120px;
  padding: 18px;
}

.unit-price-strip {
  grid-template-columns: minmax(90px, 0.32fr) minmax(140px, 0.38fr) minmax(240px, 1fr);
}

.unit-price-strip span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.unit-price-strip strong {
  color: var(--ink);
  font-size: 1.45rem;
}

.unit-price-strip small {
  color: var(--muted);
  line-height: 1.55;
}

.checkout-bar {
  grid-template-columns: minmax(110px, 0.2fr) minmax(240px, 1fr);
}

.price-card.featured {
  border-color: rgba(0, 137, 134, 0.46);
  box-shadow: 0 20px 50px rgba(0, 137, 134, 0.14);
}

.badge {
  background: var(--soft-amber);
  border-radius: 999px;
  color: #85620c;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  margin: 0 0 10px;
  padding: 5px 10px;
}

.price {
  color: var(--ink);
  font-size: 2rem;
  font-weight: 900;
  margin: 14px 0;
}

.price span {
  color: var(--muted);
  font-size: 0.95rem;
}

.checkout-message {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
  min-height: 1.2em;
}

.auth-message {
  margin: 16px auto 0;
  max-width: 1120px;
}

.pricing-message {
  margin: 16px auto 0;
  max-width: 1120px;
}

.full {
  width: 100%;
}

.footer {
  align-items: center;
  background: var(--ink);
  color: rgba(255, 255, 255, 0.82);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 24px clamp(20px, 5vw, 72px);
}

.footer > div,
.footer nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer nav a {
  color: #ffffff;
  font-size: 0.85rem;
}

.footer-brand > a {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  text-decoration: underline;
}

.footer nav a:hover {
  text-decoration: underline;
}

@media (max-width: 980px) {
  .hero,
  .demo-layout,
  .api-layout,
  .account-layout,
  body[data-view="login"] .account-layout,
  body[data-view="home"] .home-workspace,
  .recovery-grid,
  .pricing-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .home-history-slot {
    grid-column: auto;
  }

  .unit-price-strip,
  .checkout-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar,
  .history-heading,
  .panel-title-row,
  .footer {
    align-items: stretch;
    flex-direction: column;
  }

  .footer > div,
  .footer nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    flex-wrap: wrap;
  }
}
