/* ============ Kilnfolio — warm clay theme ============ */
:root {
  --clay-bg: #e8dccd;
  --clay-panel: #f4ecdf;
  --clay-deep: #d8c6ad;
  --ink: #3b2f27;
  --ink-soft: #7a6a5b;
  --primary: #b45f3c;
  --primary-deep: #96482a;
  --secondary: #6f8f7c;
  --accent: #29465b;
  --glaze-cobalt: #29465b;
  --glaze-celadon: #6f8f7c;
  --glaze-ochre: #c99a3f;
  --glaze-iron: #7a4a33;
  --radius: 14px;
  --shadow-clay: 0 2px 0 rgba(59, 47, 39, 0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Georgia", "Iowan Old Style", "Palatino", serif;
  background: var(--clay-bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.45;
}

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ============ Slim kiln-vent header rail ============ */
.ventrail {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--accent);
  color: #e9eef2;
  padding: calc(env(safe-area-inset-top) + 8px) 18px 8px;
  box-shadow: var(--shadow-clay);
}
.ventrail-vents { display: flex; gap: 5px; }
.ventrail-vents span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--secondary);
}
.ventrail-vents span:nth-child(2) { background: var(--glaze-ochre); }
.ventrail-vents span:nth-child(3) { background: var(--primary); }
.ventrail-vents span:nth-child(4) { background: #8fb3a0; }
.ventrail-name {
  font-size: 0.98rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: bold;
}
.ventrail-peak {
  margin-left: auto;
  width: 26px; height: 10px;
  background: var(--primary);
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}

/* ============ Stack layout ============ */
.stack {
  max-width: 480px;
  margin: 0 auto;
  padding: 18px 18px calc(env(safe-area-inset-bottom) + 108px);
}
.tab[hidden] { display: none; }
.tab-lede {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 14px;
  font-style: italic;
}

/* ============ Bench ============ */
.bench-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 26px;
}
.bench-lead {
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: bold;
}
.total-coin {
  flex: none;
  width: 92px; height: 92px;
  border-radius: 50%;
  background: var(--primary);
  color: #f7ede2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,0.16), var(--shadow-clay);
  border: 4px solid var(--primary-deep);
}
.total-num { font-size: 1.7rem; font-weight: bold; line-height: 1; }
.total-word { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; }

.rail-label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 22px 0 10px;
}

.record-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--primary);
  color: #fdf4ea;
  border-radius: var(--radius);
  padding: 18px 18px;
  text-align: left;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.15), var(--shadow-clay);
  transition: transform 0.08s ease;
}
.record-strip:active { transform: translateY(2px); }
.strip-pool {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--glaze-cobalt);
  border: 3px solid #f7ede2;
}
.strip-text { display: flex; flex-direction: column; gap: 1px; }
.strip-text strong { font-size: 1.08rem; }
.strip-text small { font-size: 0.78rem; opacity: 0.85; }
.strip-arrow { margin-left: auto; font-size: 1.3rem; }

.cone-line { display: flex; flex-wrap: wrap; gap: 8px; }
.cone-chip-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--clay-panel);
  border: 1px solid var(--clay-deep);
  border-radius: 999px;
  padding: 6px 12px 6px 8px;
  font-size: 0.82rem;
}
.cone-chip-line .mini-dot {
  width: 12px; height: 12px; border-radius: 50%;
}

/* ============ GlazeTest tile cards ============ */
.tile-card {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  background: var(--clay-panel);
  border: 1px solid var(--clay-deep);
  border-radius: var(--radius);
  padding: 13px 14px 13px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-clay);
  transition: transform 0.08s ease;
  overflow: hidden;
}
.tile-card:active { transform: scale(0.985); }
.tile-card.pinned {
  border-left: none;
  background: var(--clay-panel);
  padding: 18px 18px 18px 20px;
}
.tile-card.pinned::after {
  content: "pinned";
  position: absolute;
  top: 10px; right: 12px;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 999px;
  padding: 2px 8px;
}
.tile-stripe {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 7px;
}
.tile-row { display: flex; align-items: flex-start; gap: 12px; }
.cone-chip {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f6f1e8;
  font-size: 0.86rem;
  font-weight: bold;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2);
}
.tile-main { min-width: 0; }
.tile-name {
  font-weight: bold;
  font-size: 1.02rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile-clay { font-size: 0.86rem; color: var(--ink-soft); }
.tile-note {
  margin-top: 7px;
  font-size: 0.84rem;
  color: var(--ink-soft);
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-note.none { opacity: 0.6; font-style: normal; }

/* ============ Empty states ============ */
.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 26px 12px;
  font-size: 0.92rem;
}
.empty-tile {
  width: 58px; height: 58px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: var(--clay-deep);
  position: relative;
}
.empty-tile::before {
  content: "";
  position: absolute;
  inset: 16px 18px;
  border-radius: 50%;
  background: var(--clay-bg);
}

/* ============ Tiles rack ============ */
.rack-group { margin-bottom: 22px; }
.rack-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.rack-head .cone-chip { width: 34px; height: 34px; font-size: 0.78rem; }
.rack-head h3 { font-size: 1.05rem; }
.rack-head small { color: var(--ink-soft); font-size: 0.78rem; }

/* ============ Record form panel ============ */
.record-mode {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--secondary);
  border-bottom: 2px solid var(--secondary);
  padding-bottom: 4px;
  margin-bottom: 14px;
}
.tile-panel {
  background: var(--clay-panel);
  border: 1px solid var(--clay-deep);
  border-radius: var(--radius);
  padding: 20px 18px 16px;
  box-shadow: var(--shadow-clay);
}
.pool-badge {
  width: 54px; height: 54px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--clay-bg);
  border: 2px solid var(--clay-deep);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pool-swatch {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--glaze-iron);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.18);
}

.field { margin-bottom: 16px; }
.field label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field label em {
  font-style: normal;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--primary);
}
.field input,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fbf7ef;
  border: 1.5px solid var(--clay-deep);
  border-radius: 10px;
  padding: 13px 14px;
  min-height: 48px;
  appearance: none;
}
.field textarea { resize: vertical; min-height: 88px; }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(41, 70, 91, 0.15);
}
.field.invalid input { border-color: var(--primary-deep); background: #f7e6de; }
.err {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--primary-deep);
}

.form-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.btn-primary {
  background: var(--primary);
  color: #fdf4ea;
  font-size: 1.05rem;
  font-weight: bold;
  border-radius: 12px;
  padding: 15px;
  min-height: 52px;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.16);
}
.btn-primary:active { transform: translateY(1px); }
.btn-quiet {
  background: none;
  border: 1.5px solid var(--clay-deep);
  color: var(--ink-soft);
  border-radius: 12px;
  padding: 13px;
  min-height: 48px;
}
.btn-danger {
  background: none;
  border: 1.5px solid var(--primary-deep);
  color: var(--primary-deep);
  border-radius: 12px;
  padding: 13px;
  min-height: 48px;
}
.form-note {
  margin-top: 12px;
  text-align: center;
  font-size: 0.74rem;
  color: var(--ink-soft);
}

/* ============ Find ============ */
.search-wrap { margin-bottom: 14px; }
.search-wrap input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  background: var(--clay-panel);
  border: 1.5px solid var(--clay-deep);
  border-radius: 999px;
  padding: 13px 20px;
  min-height: 50px;
  appearance: none;
}
.search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(41, 70, 91, 0.15);
}
.find-meta {
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

/* ============ Bottom stilt tab bar ============ */
.stilts {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  gap: 4px;
  max-width: 480px;
  margin: 0 auto;
  background: var(--clay-panel);
  border-top: 1.5px solid var(--clay-deep);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  box-shadow: 0 -4px 12px rgba(59, 47, 39, 0.08);
}
.stilt {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px 4px;
  border-radius: 10px;
  color: var(--ink-soft);
}
.stilt-word {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.stilt-shape {
  display: block;
  width: 30px; height: 20px;
  transition: transform 0.15s ease;
}
/* flat kiln-stilt silhouettes */
.stilt-bench { background: var(--clay-deep); clip-path: polygon(0 100%, 12% 30%, 88% 30%, 100% 100%, 72% 100%, 50% 55%, 28% 100%); }
.stilt-tiles { background: var(--clay-deep); clip-path: polygon(0 100%, 0 22%, 30% 0, 70% 0, 100% 22%, 100% 100%, 62% 100%, 62% 45%, 38% 45%, 38% 100%); }
.stilt-record { background: var(--clay-deep); clip-path: polygon(10% 100%, 10% 15%, 90% 15%, 90% 100%, 64% 100%, 64% 42%, 36% 42%, 36% 100%); }
.stilt-find { background: var(--clay-deep); clip-path: polygon(0 100%, 22% 20%, 78% 20%, 100% 100%, 70% 100%, 50% 62%, 30% 100%); }
.stilt.active { color: var(--primary-deep); }
.stilt.active .stilt-shape {
  transform: rotate(-7deg) translateY(-2px);
  background: var(--primary);
  box-shadow: 3px 3px 0 rgba(59, 47, 39, 0.25);
}

/* ============ Small screens / large screens ============ */
@media (min-width: 480px) {
  .stack { padding-left: 24px; padding-right: 24px; }
}
