:root {
  --bg: #f7f8f5;
  --panel: #ffffff;
  --paper: #fbfaf6;
  --ink: #1e2d35;
  --muted: #637179;
  --line: #dbe2de;
  --blue: #4d8794;
  --blue-dark: #2f6875;
  --green: #5f9381;
  --warm: #d8b789;
  --warm-light: #f5ebdd;
  --danger: #b64545;
  --shadow: 0 16px 40px rgba(30, 45, 53, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f7f8f5 0%, #eef3f0 100%);
  color: var(--ink);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  line-height: 1.75;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.auth-panel,
.tool-area,
.result-area,
.site-header {
  width: min(960px, calc(100vw - 32px));
  margin: 0 auto;
}

.auth-panel {
  max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 36px;
}

.app-shell {
  padding: 36px 0 64px;
}

.site-header {
  padding: 12px 0 26px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue-dark);
  font-size: 0.88rem;
  font-weight: 700;
}

h1,
h2,
h3,
h4,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.25;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 18px;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 1.06rem;
  letter-spacing: 0;
}

h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.lead {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.auth-form {
  margin-top: 26px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid #c8d4cf;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input {
  min-height: 48px;
  padding: 10px 12px;
}

textarea {
  min-height: 160px;
  padding: 14px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(77, 135, 148, 0.16);
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.icon-button {
  min-width: 68px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f6f4;
  color: var(--ink);
  font-weight: 700;
}

.tool-area,
.result-area {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tool-area {
  padding: 22px;
}

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

.tab-button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f7f6;
  color: var(--ink);
  font-weight: 700;
}

.tab-button.active[data-tab="A"] {
  background: #e5f0ef;
  border-color: #91bab4;
  color: #235e67;
}

.tab-button.active[data-tab="B"] {
  background: var(--warm-light);
  border-color: #dfc49b;
  color: #73593a;
}

.tab-description {
  margin: 16px 0 24px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.mode-panel {
  display: grid;
  gap: 18px;
}

.question-group {
  margin: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mode-a .question-group.required {
  border-left: 4px solid var(--blue);
}

.mode-b .question-group.required {
  border-left: 4px solid var(--warm);
}

legend {
  padding: 0 6px;
  font-weight: 800;
}

.hint {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 0.94rem;
}

.block-note {
  margin-top: 12px;
}

.options {
  display: grid;
  gap: 10px;
}

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

.option-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #d5dfda;
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
}

.option-card input {
  width: auto;
  min-height: auto;
  margin-top: 5px;
  accent-color: var(--blue-dark);
}

.option-card span {
  min-width: 0;
}

.textarea-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.voice-button,
.secondary-button,
.primary-button {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.voice-button {
  min-height: 40px;
  padding: 8px 14px;
  background: #e8f1ef;
  color: #255f63;
  border: 1px solid #a6c7c1;
}

.voice-button.is-listening {
  background: #b64545;
  border-color: #b64545;
  color: #fff;
}

.voice-button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.voice-status {
  min-height: 1.5em;
  margin: 0 0 8px;
  color: #755323;
  font-weight: 800;
}

.sample-box,
.soft-note,
.before-generate {
  border-radius: 8px;
  padding: 16px;
}

.sample-box {
  margin-top: 12px;
  background: #f4f8f7;
  border: 1px solid #d9e5e1;
}

.sample-box p {
  margin: 8px 0 0;
  color: #43535a;
}

.soft-note {
  margin: 0;
  background: var(--warm-light);
  border: 1px solid #ead6b8;
  color: #665947;
}

.before-generate {
  margin: 0;
  background: #f4f7f5;
  border: 1px solid var(--line);
  color: #43535a;
}

.primary-button {
  min-height: 52px;
  padding: 12px 22px;
  background: var(--blue-dark);
  color: #fff;
}

.primary-button:hover {
  background: #275761;
}

.primary-button.full {
  width: 100%;
}

.secondary-button {
  min-height: 46px;
  padding: 10px 18px;
  background: #fff;
  color: var(--blue-dark);
  border: 1px solid #9ebfba;
}

.result-area {
  margin-top: 22px;
  padding: 22px;
}

.result-area textarea {
  font-family: Consolas, "Yu Gothic", Meiryo, monospace;
  line-height: 1.65;
  white-space: pre-wrap;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.error-text {
  min-height: 1.5em;
  margin: 8px 0 0;
  color: var(--danger);
  font-weight: 700;
}

.status-text,
.limit-message {
  min-height: 1.5em;
  margin: 8px 0 0;
  color: var(--green);
  font-weight: 700;
}

@media (max-width: 760px) {
  .auth-panel,
  .tool-area,
  .result-area,
  .site-header {
    width: min(100% - 24px, 960px);
  }

  .auth-panel,
  .tool-area,
  .result-area,
  .question-group {
    padding: 16px;
  }

  .tabs,
  .grid-options,
  .textarea-heading,
  .password-row {
    grid-template-columns: 1fr;
  }

  .tab-button {
    min-height: 48px;
  }

  .voice-button {
    width: 100%;
  }

  .action-row {
    display: grid;
  }
}
