:root {
  color-scheme: light;
  --bg: #f4f1eb;
  --ink: #202124;
  --muted: #68635c;
  --line: #d8d0c3;
  --panel: #fffdf8;
  --accent: #176b63;
  --accent-strong: #0e4f49;
  --danger: #a33b32;
  --shadow: 0 22px 55px rgba(32, 33, 36, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(135deg, rgba(23, 107, 99, 0.1), transparent 38%),
    linear-gradient(315deg, rgba(195, 135, 45, 0.12), transparent 40%),
    var(--bg);
  color: var(--ink);
  font-family:
    "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 38px 0 56px;
  flex: 1;
}

.hero {
  margin-bottom: 28px;
}

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

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.5rem, 7vw, 5.4rem);
}

h2 {
  font-size: 1.08rem;
}

.composer,
.result-panel,
.manual-panel {
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.composer {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.type-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.type-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f4ed;
  color: var(--muted);
  font-weight: 800;
}

.type-button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: end;
}

.input-wrap {
  position: relative;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 10px 60px 10px 12px;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 99, 0.14);
}

.paste-button {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-grid;
  place-items: center;
  width: 36px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8f4ed;
  color: var(--muted);
}

.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

.start-button,
.secondary-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.start-button:hover,
.secondary-button:hover {
  background: var(--accent-strong);
}

.status {
  min-height: 0;
  padding: 10px 12px;
  border: 1px solid rgba(23, 107, 99, 0.18);
  border-radius: 8px;
  background: rgba(23, 107, 99, 0.06);
  color: var(--muted);
  line-height: 1.55;
}

.status.is-error {
  border-color: rgba(163, 59, 50, 0.26);
  background: rgba(163, 59, 50, 0.07);
  color: var(--danger);
}

.runtime-warning {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(163, 59, 50, 0.28);
  border-radius: 8px;
  background: rgba(163, 59, 50, 0.08);
  color: var(--danger);
  font-weight: 800;
}

.terms-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

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

#candidatePanel,
.workspace,
.history-panel {
  margin-top: 18px;
}

.history-panel {
  background: rgba(255, 253, 248, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.history-panel h2 {
  margin-bottom: 12px;
}

.history-panel ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.2em;
  color: var(--muted);
  line-height: 1.6;
}

.history-panel time {
  color: var(--ink);
  font-weight: 800;
}

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

.result-panel,
.manual-panel {
  padding: 18px;
}

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

.ghost-button {
  min-width: 72px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.candidates {
  display: grid;
  gap: 8px;
}

.candidate {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  text-align: left;
}

.candidate:hover {
  border-color: var(--accent);
}

.candidate strong {
  line-height: 1.35;
}

.candidate span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.reference-list {
  display: grid;
  gap: 12px;
}

.reference-style {
  display: grid;
  gap: 10px;
  min-height: 112px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.reference-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reference-style h3 {
  color: var(--accent);
  font-size: 0.94rem;
}

.reference-style output {
  white-space: pre-wrap;
  line-height: 1.75;
}

.manual-table {
  display: grid;
  margin: 16px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.manual-table label {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.manual-table label:last-child {
  border-bottom: 0;
}

.manual-table span {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: #f8f4ed;
  border-right: 1px solid var(--line);
}

.manual-table input {
  margin: 0;
  min-height: 53px;
  border: 0;
  border-radius: 0;
  background: #fff;
  padding-right: 12px;
}

.secondary-button {
  width: 220px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  justify-content: center;
  width: min(1120px, calc(100% - 32px));
  margin: auto auto 0;
  padding: 18px 0 24px;
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 22px, 620px);
    padding-top: 22px;
  }

  .input-row {
    grid-template-columns: minmax(0, 1fr) 82px;
    gap: 8px;
  }

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

  .start-button {
    min-width: 82px;
  }

  .manual-table label {
    grid-template-columns: 1fr;
  }

  .manual-table span {
    min-height: 40px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .secondary-button {
    width: 100%;
  }
}
