:root {
  --bg: #fff7f2;
  --card: #ffffff;
  --ink: #4a3b36;
  --sub: #8a7168;
  --accent: #e1306c;
  --accent-soft: #ffe3ee;
  --gold: #f5a623;
  --line: #f3ddd3;
  --shadow: 0 4px 14px rgba(190, 120, 90, 0.14);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(120deg, #feda75, #fa7e1e, #d62976, #962fbf);
  color: #fff;
  box-shadow: var(--shadow);
}

.appbar h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.appbar-btn {
  border: none;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  font-size: 18px;
  width: 40px;
  height: 40px;
  cursor: pointer;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(40px + env(safe-area-inset-bottom));
}

.lead {
  font-size: 17px;
  font-weight: 700;
  margin: 8px 4px 14px;
}

.hidden {
  display: none !important;
}

/* --- 種類えらび --- */

.type-cards {
  display: grid;
  gap: 12px;
}

.type-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  grid-template-areas:
    "emoji name badge"
    "emoji desc desc";
  align-items: center;
  gap: 2px 10px;
  text-align: left;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  transition: transform 0.1s;
}

.type-card:active {
  transform: scale(0.98);
}

.type-emoji {
  grid-area: emoji;
  font-size: 34px;
  text-align: center;
}

.type-name {
  grid-area: name;
  font-size: 17px;
  font-weight: 800;
}

.type-desc {
  grid-area: desc;
  font-size: 13px;
  color: var(--sub);
}

.badge {
  grid-area: badge;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.yes {
  background: #e3f8e9;
  color: #1d8a45;
}

.badge.no {
  background: #ffe9e3;
  color: #c05a30;
}

.mini-hint {
  font-size: 13px;
  color: var(--sub);
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 16px;
  line-height: 1.6;
}

/* --- モード切り替え --- */

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #f7e3d7;
  border-radius: 999px;
  padding: 5px;
  margin-bottom: 14px;
}

.mode-btn {
  border: none;
  border-radius: 999px;
  padding: 11px 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  color: var(--sub);
  background: transparent;
  cursor: pointer;
}

.mode-btn.on {
  color: #fff;
  background: linear-gradient(120deg, #fa7e1e, #d62976);
  box-shadow: var(--shadow);
}

/* --- 入力フォーム --- */

.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--sub);
}

.field.two {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field.two label {
  display: grid;
  gap: 6px;
}

input,
select,
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fffdfb;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.url-note {
  margin: 0;
  font-size: 12px;
  color: var(--sub);
  word-break: break-all;
  line-height: 1.6;
}

/* --- ボタン --- */

.big-button {
  display: block;
  width: 100%;
  margin-top: 14px;
  border: none;
  border-radius: 999px;
  padding: 15px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(120deg, #fa7e1e, #d62976);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s;
}

.big-button:active {
  transform: scale(0.98);
}

.ghost-button {
  display: block;
  width: 100%;
  margin-top: 10px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--sub);
  background: transparent;
  cursor: pointer;
}

.ghost-button:disabled {
  opacity: 0.35;
}

/* --- ナビ --- */

.navi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 4px 10px;
  font-weight: 800;
}

.navi-progress {
  color: var(--sub);
  font-size: 14px;
}

.dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 14px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}

.dot.done {
  background: #f7b98d;
}

.dot.on {
  background: var(--accent);
  transform: scale(1.25);
}

.step-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
}

.step-number {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(120deg, #fa7e1e, #d62976);
  border-radius: 999px;
  padding: 4px 12px;
}

.step-title {
  margin: 10px 0 8px;
  font-size: 19px;
  line-height: 1.4;
}

.step-body {
  margin: 0;
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink);
  white-space: pre-line;
}

.copy-block {
  margin-top: 14px;
}

.copy-block textarea {
  background: #fff4ec;
  border-color: #f7c9a8;
  font-size: 14px;
  line-height: 1.6;
}

.big-button.copy {
  margin-top: 10px;
}

.navi-buttons {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.navi-buttons .ghost-button,
.navi-buttons .big-button {
  margin-top: 0;
}

/* --- 早見表モーダル --- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(74, 59, 54, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 18px;
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.cheat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.cheat-table th,
.cheat-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 6px;
  text-align: left;
  vertical-align: top;
  line-height: 1.6;
}

.cheat-table th {
  white-space: nowrap;
  color: var(--accent);
}

/* --- トースト --- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(30px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 99;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
