/* ===== Reset ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; min-height: 100%; overflow-x: hidden; }

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: #1a1108;
  min-height: 100vh;
}

/* ===== Wood Texture Background ===== */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    repeating-linear-gradient(93deg, transparent 0px, rgba(255,220,120,0.025) 1px, transparent 2px, transparent 18px),
    repeating-linear-gradient(180deg, transparent 0px, rgba(0,0,0,0.18) 1px, transparent 2px, transparent 55px),
    linear-gradient(160deg, #2a1a08 0%, #1a1005 40%, #221508 100%);
  pointer-events: none;
}

/* ===== App Container ===== */
.app { position: relative; z-index: 1; max-width: 540px; margin: 0 auto; padding: 0 0 40px; }

/* ===== Signboard Header ===== */
.signboard {
  background: linear-gradient(180deg, #3d2a10 0%, #2a1a08 100%);
  border-bottom: 4px solid #8b5a1a;
  box-shadow: 0 4px 0 #4a2e08, 0 8px 24px rgba(0,0,0,0.6);
  padding: 22px 20px 18px;
  text-align: center;
  position: relative; overflow: hidden;
}
.signboard::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0, transparent 30px, rgba(255,200,80,0.035) 30px, rgba(255,200,80,0.035) 31px);
}
.sign-lanterns { display: flex; justify-content: center; gap: 6px; margin-bottom: 10px; }
.lantern {
  font-size: 22px;
  animation: sway 3s ease-in-out infinite;
  transform-origin: top center;
  display: inline-block;
}
.lantern:nth-child(2) { animation-delay: 0.5s; }
.lantern:nth-child(3) { animation-delay: 1s; }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.sign-title {
  font-family: 'Zen Antique Soft', serif;
  font-size: clamp(22px, 5.5vw, 34px);
  color: #f5d070;
  text-shadow: 0 0 20px rgba(255,180,40,0.5), 2px 2px 0 rgba(0,0,0,0.5);
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}
.sign-sub { font-size: 12px; color: rgba(245,208,112,0.55); letter-spacing: 0.2em; font-weight: 700; }

/* ===== Progress Nails ===== */
.progress-bar { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 14px 0 8px; position: relative; z-index: 1; }
.nail { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.1); border: 1.5px solid rgba(255,255,255,0.15); transition: all 0.3s; }
.nail.done { background: #f5d070; border-color: #f5d070; box-shadow: 0 0 8px rgba(245,208,112,0.5); }
.nail.active { background: transparent; border-color: rgba(245,208,112,0.7); animation: nail-pulse 1.5s ease-in-out infinite; }
@keyframes nail-pulse { 0%, 100% { box-shadow: 0 0 4px rgba(245,208,112,0.3); } 50% { box-shadow: 0 0 14px rgba(245,208,112,0.7); } }
.nail-connector { width: 24px; height: 1.5px; background: rgba(255,255,255,0.08); }
.nail-connector.done { background: rgba(245,208,112,0.4); }

/* ===== Blackboard ===== */
.board {
  margin: 12px 12px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(60,90,60,0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(40,70,50,0.18) 0%, transparent 50%),
    linear-gradient(160deg, #1e2e1e 0%, #172217 50%, #1a2a1a 100%);
  border-radius: 4px;
  border: 3px solid #4a3010;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.5), 0 6px 30px rgba(0,0,0,0.7), 4px 4px 0 #2a1a08;
  position: relative; overflow: hidden;
}
.board::after {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none; opacity: 0.7; z-index: 0;
}

/* ===== Board Sections ===== */
.board-section { padding: 20px 18px 24px; position: relative; z-index: 1; display: none; text-align: center; }
.board-section.active { display: block; animation: chalk-in 0.4s ease forwards; }
@keyframes chalk-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Chalk Text ===== */
.chalk-heading {
  font-family: 'Zen Antique Soft', serif;
  font-size: clamp(16px, 4vw, 21px);
  color: #e8e0c8;
  text-shadow: 0 0 8px rgba(255,255,255,0.12);
  margin-bottom: 5px;
  letter-spacing: 0.06em;
  display: inline-block;
}
.chalk-heading::after {
  content: ''; display: block; height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(240,220,140,0.7) 50%, transparent 100%);
  margin-top: 5px; border-radius: 1px;
}
.chalk-sub { font-size: 12px; color: rgba(220,210,180,0.45); font-weight: 700; margin-bottom: 16px; letter-spacing: 0.04em; }

/* ===== Option Grid ===== */
.opt-grid { display: grid; gap: 10px; }
.opt-grid.cols2 { grid-template-columns: 1fr 1fr; }
.opt-grid.cols3 { grid-template-columns: 1fr 1fr 1fr; }
.opt-grid.cols2-wide .wide-card { grid-column: 1 / -1; }

.opt-card {
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.09);
  border-radius: 10px;
  padding: 16px 6px 13px;
  cursor: pointer; text-align: center;
  transition: all 0.18s ease;
  position: relative; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.opt-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,0.035) 0%, transparent 60%); pointer-events: none; }
.opt-card:hover { border-color: rgba(245,208,112,0.45); background: rgba(245,208,112,0.06); transform: translateY(-2px); }
.opt-card:active { transform: scale(0.97); }
.opt-card.selected {
  border-color: #f5d070;
  background: linear-gradient(135deg, rgba(245,208,112,0.14) 0%, rgba(245,208,112,0.04) 100%);
  box-shadow: 0 0 18px rgba(245,208,112,0.18);
  transform: scale(1.03);
}
.opt-card.selected::after { content: '✓'; position: absolute; top: 6px; right: 8px; font-size: 11px; font-weight: 900; color: #f5d070; }

.opt-icon { font-size: clamp(30px, 7vw, 42px); display: block; margin-bottom: 7px; line-height: 1; }
.opt-label { font-family: 'Kiwi Maru', serif; font-size: clamp(11px, 2.6vw, 14px); color: #e8e0c8; font-weight: 500; line-height: 1.35; display: block; }
.opt-note { font-size: 10px; color: rgba(220,200,140,0.45); margin-top: 3px; display: block; }

/* ===== Loading ===== */
#loadingRow { display: none; padding: 24px 0; text-align: center; position: relative; z-index: 1; }
.dots { display: inline-flex; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(245,208,112,0.35); animation: dot-b 1.2s ease-in-out infinite; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-b { 0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

/* ===== Result ===== */
.result-board { padding: 18px; }

.name-plate {
  background: linear-gradient(135deg, rgba(139,90,26,0.28) 0%, rgba(60,40,10,0.38) 100%);
  border: 2px solid rgba(139,90,26,0.45);
  border-radius: 10px;
  padding: 18px 16px 14px;
  margin-bottom: 13px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255,220,100,0.08);
}
.name-plate-eyebrow { font-size: 10px; font-weight: 700; color: rgba(245,208,112,0.45); letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 6px; }
.name-plate-name {
  font-family: 'Zen Antique Soft', serif;
  font-size: clamp(24px, 6vw, 38px);
  color: #f5e8b0;
  text-shadow: 0 0 20px rgba(245,220,100,0.25), 2px 2px 0 rgba(0,0,0,0.5);
  letter-spacing: 0.06em;
  line-height: 1.2;
  margin-bottom: 5px;
}
.name-plate-brewery { font-size: 12px; color: rgba(220,200,160,0.5); }

.tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 13px; }
.tag { padding: 6px 13px; border-radius: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }
.tag.degree { background: rgba(26,127,168,0.18); color: #7dd4f0; border: 1px solid rgba(74,184,224,0.22); }
.tag.type { background: rgba(212,168,50,0.13); color: #f0cc60; border: 1px solid rgba(212,168,50,0.28); }

.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 13px; }
.meter-box { background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 10px 12px; }
.meter-label { font-size: 10px; font-weight: 700; color: rgba(220,200,150,0.5); letter-spacing: 0.1em; margin-bottom: 6px; }
.meter-track { height: 7px; background: rgba(255,255,255,0.07); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.meter-fill { height: 100%; border-radius: 4px; width: 0; transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1); }
.meter-fill.rich { background: linear-gradient(90deg, #c06020, #e08030); }
.meter-fill.sweet { background: linear-gradient(90deg, #b04080, #e06080); }
.meter-value { font-size: 10px; color: rgba(220,200,140,0.38); text-align: right; }

.section-title { font-family: 'Zen Antique Soft', serif; font-size: 12px; color: rgba(245,220,140,0.5); letter-spacing: 0.12em; margin-bottom: 8px; }
.chalk-divider { border: none; border-top: 1px dashed rgba(255,255,255,0.1); margin: 13px 0; }

.method-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 0; }
.method-tile { background: rgba(245,208,112,0.05); border: 1px solid rgba(245,208,112,0.13); border-radius: 8px; padding: 12px 6px 10px; text-align: center; }
.method-icon { font-size: 20px; display: block; margin-bottom: 5px; }
.method-name { font-size: 11px; font-weight: 700; color: #e8d890; display: block; margin-bottom: 2px; }
.method-note { font-size: 9px; color: rgba(220,200,130,0.42); line-height: 1.5; }

.pairing-row { display: flex; flex-wrap: wrap; gap: 7px; }
.pairing-chip { padding: 7px 12px; background: rgba(58,173,108,0.09); border: 1px solid rgba(58,173,108,0.18); border-radius: 20px; font-size: 12px; font-weight: 700; color: #7dd4a8; }

.alts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.alt-tile { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); border-radius: 8px; padding: 12px; cursor: pointer; transition: all 0.18s; }
.alt-tile:hover { border-color: rgba(245,208,112,0.3); background: rgba(245,208,112,0.05); }
.alt-tile-icon { font-size: 18px; display: block; margin-bottom: 5px; }
.alt-tile-name { font-size: 12px; font-weight: 700; color: #e8d890; margin-bottom: 3px; }
.alt-tile-note { font-size: 10px; color: rgba(200,185,145,0.45); line-height: 1.4; }

/* ===== Reset Button ===== */
.reset-row { text-align: center; padding: 10px 0 0; position: relative; z-index: 1; }
.reset-link { background: none; border: none; color: rgba(220,200,140,0.38); font-size: 12px; font-weight: 700; cursor: pointer; letter-spacing: 0.08em; text-decoration: underline; font-family: 'Noto Sans JP', sans-serif; }
.reset-link:hover { color: rgba(245,208,112,0.65); }

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .opt-grid.cols3 { grid-template-columns: 1fr 1fr 1fr; }
}
