:root {
  color: #172033;
  background: #fff;
  --accent: #006cff;
  --accent-2: #00a78e;
  --soft: #f6f8fb;
  --input-panel-width: 500px;
  --input-height: 430px;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-feature-settings: "palt" 1;
  line-height: 1.72;
  font-weight: 350;
  font-size: 15px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: #fff;
}

button,
textarea,
select {
  font: inherit;
}

button,
select {
  min-height: 40px;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1040px, calc(100% - 88px));
  margin: 0 auto;
  padding: 38px 0 64px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #111827;
  font-weight: 650;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2.1vw, 1.62rem);
  font-weight: 500;
  letter-spacing: 0;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
  color: #526070;
  font-size: 0.86rem;
}

.layout {
  display: flex;
  flex-wrap: wrap;
  gap: 38px;
  align-items: start;
}

.left-column,
.right-column {
  display: grid;
  gap: 28px;
  min-width: 0;
}

.left-column {
  flex: 0 1 min(var(--input-panel-width), 100%);
  width: min(var(--input-panel-width), 100%);
}

.right-column {
  flex: 1 1 420px;
}

.lead {
  margin: 0;
  color: #4b5563;
  max-width: 760px;
  font-size: 0.94rem;
  line-height: 1.9;
}

.value-copy {
  margin: -10px 0 0;
  max-width: 760px;
  padding: 12px 15px;
  border-left: 3px solid var(--accent-2);
  border-radius: 6px;
  background: #f3fbfa;
  color: #3f4b5d;
  font-size: 0.9rem;
  line-height: 1.8;
}

.mode-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  background: #f7f9fc;
  color: #526070;
}

.mode-card > span {
  font-size: 0.9rem;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 0;
  border-radius: 8px;
  background: #f2f5f9;
}

.segmented button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  background: transparent;
  color: #526070;
  font-weight: 400;
}

.segmented button.active {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

.card {
  background: rgba(255, 255, 255, 0.68);
  border: 0;
  border-radius: 8px;
  padding: 18px 0;
  box-shadow: none;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-title h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 560;
}

.text-button {
  margin-left: auto;
  min-height: 28px;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.78rem;
}

.text-button:hover {
  text-decoration: underline;
}

.icon {
  color: var(--accent-2);
  font-weight: 700;
}

.blue { color: var(--accent); }
.green { color: var(--accent-2); }
.red { color: #dc2626; }
.teal { color: var(--accent-2); }
.purple { color: #4f46e5; }

.textarea-wrap {
  position: relative;
}

textarea {
  width: 100%;
  height: var(--input-height);
  min-height: 260px;
  resize: none;
  border: 1.5px solid rgba(0, 108, 255, 0.56);
  border-radius: 8px;
  padding: 20px 20px 52px;
  color: #111827;
  background: #fff;
  outline: none;
  line-height: 1.85;
  font-weight: 400;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 108, 255, 0.1);
}

.resize-handle {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border-radius: 4px;
  background:
    linear-gradient(135deg, transparent 52%, rgba(0, 108, 255, 0.7) 52%, rgba(0, 108, 255, 0.7) 60%, transparent 60%),
    linear-gradient(135deg, transparent 68%, rgba(0, 108, 255, 0.45) 68%, rgba(0, 108, 255, 0.45) 76%, transparent 76%);
  cursor: nwse-resize;
}

.textarea-count {
  position: absolute;
  right: 14px;
  bottom: 12px;
  color: #64748b;
  font-size: 0.88rem;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.ghost-button,
.accent-button {
  border-radius: 7px;
  padding: 9px 14px;
  font-weight: 400;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.75);
  color: #253044;
  border: 0;
}

.accent-button {
  background: var(--accent);
  color: #fff;
}

.privacy-note {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 7px;
  background: var(--soft);
  color: #4b5563;
  font-size: 0.84rem;
  line-height: 1.75;
}

.basis-note {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 0.82rem;
}

.stats-grid,
.reading-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.wide-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.stat-box,
.reading-box {
  min-width: 0;
  border: 1px solid rgba(226, 232, 240, 0.78);
  border-radius: 7px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.82);
}

.stat-box span,
.reading-box span,
.preview-block > span {
  display: block;
  color: #596779;
  font-size: 0.76rem;
}

.stat-box strong {
  display: block;
  font-size: clamp(1rem, 1.55vw, 1.28rem);
  line-height: 1.15;
  font-weight: 600;
}

small {
  color: #64748b;
}

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

.check-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 13px;
  border: 0;
  border-radius: 7px;
  background: rgba(248, 250, 252, 0.78);
}

.check-row p {
  margin: 3px 0 0;
  color: #607086;
  font-size: 0.82rem;
}

.check-row strong {
  font-weight: 520;
}

.pill {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 520;
  white-space: nowrap;
}

.good { background: #dcfce7; color: #047857; }
.bad { background: #fee2e2; color: #b91c1c; }
.warn { background: #fef3c7; color: #b45309; }
.info { background: #dbeafe; color: #1d4ed8; }

.preview-block + .preview-block {
  margin-top: 18px;
}

.phone-preview,
.desktop-preview {
  min-width: 0;
  margin-top: 8px;
  border: 0;
  border-radius: 7px;
  background: rgba(248, 250, 252, 0.78);
  overflow: hidden;
}

.phone-preview {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 10px;
  max-width: 410px;
  padding: 12px;
}

.video-thumb {
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  background: linear-gradient(135deg, #111827, #374151);
}

.preview-text,
.desktop-preview {
  min-width: 0;
}

.preview-text strong,
.desktop-preview strong {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-preview {
  padding: 12px;
  max-width: 560px;
}

.split-title {
  justify-content: space-between;
}

.split-title > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

select {
  border: 0;
  border-radius: 7px;
  background: #fff;
  padding: 0 12px;
}

.telop-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.telop-set {
  position: relative;
  padding: 13px;
  border-radius: 7px;
  background: #f0fbf9;
  border: 0;
  line-height: 1.8;
}

.telop-label {
  position: absolute;
  top: 10px;
  right: 12px;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-2);
  font-size: 0.78rem;
}

.telop-set p {
  margin: 0;
}

.empty {
  color: #64748b;
  border: 0;
  border-radius: 7px;
  padding: 14px;
}

.reading-box {
  text-align: center;
  background: #fbfcff;
}

.reading-box strong {
  display: block;
  font-size: 1rem;
  font-weight: 540;
}

.hint {
  text-align: center;
  margin: 16px 0 0;
  color: #64748b;
  font-size: 0.86rem;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  padding: 12px 16px;
  border-radius: 999px;
  background: #172033;
  color: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

footer {
  display: grid;
  gap: 18px;
  margin-top: 28px;
  color: #64748b;
  font-size: 0.86rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-links a {
  color: inherit;
  text-decoration: none;
}

footer p {
  margin: 0;
  overflow-wrap: anywhere;
}

.made-by a {
  color: inherit;
  text-decoration: none;
}

.made-by a:hover,
.footer-links a:hover {
  color: var(--accent);
}

.lead,
.card {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .app-shell {
    width: min(720px, calc(100% - 44px));
    padding-top: 26px;
  }

  .site-header {
    align-items: flex-start;
  }

  nav {
    display: none;
  }

  .left-column,
  .right-column {
    flex-basis: 100%;
    width: 100%;
  }

  textarea {
    height: min(var(--input-height), 520px);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .wide-stats,
  .reading-grid {
    grid-template-columns: 1fr;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  .mode-card {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .card {
    padding: 15px;
    border-radius: 8px;
  }

  .phone-preview {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .check-row {
    grid-template-columns: 1fr auto;
  }

  .check-row small {
    grid-column: 1 / -1;
  }
}
