/* あつまるん prototype - 明るくポップな配色 */
:root {
  --bg: #FFF8EE;
  --card: #FFFFFF;
  --ink: #4A3F33;
  --dim: #A0937F;
  --line: #F0E6D6;
  --accent: #FF7A2F;      /* オレンジ: 主役 */
  --accent-soft: #FFE8D8;
  --ok: #2FBF8F;          /* ミント: ◯ */
  --ok-soft: #DFF7EE;
  --maybe: #FFC531;       /* イエロー: △ */
  --maybe-soft: #FFF3D1;
  --blank: #F7F1E6;
  --danger: #E85A4F;
}

* { box-sizing: border-box; }

/* display:flex等の指定があってもhidden属性を必ず効かせる */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'M PLUS Rounded 1c', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  line-height: 1.6;
}

main { max-width: 960px; margin: 0 auto; padding: 0 14px 40px; }

/* header */
.site-header {
  text-align: center;
  padding: 30px 14px 12px;
  position: relative;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
}
.logo-mark {
  display: grid;
  grid-template-columns: repeat(2, 15px);
  grid-auto-rows: 15px;
  gap: 3px;
  transform: rotate(-8deg);
  transition: transform 0.2s;
}
.brand:hover .logo-mark { transform: rotate(4deg); }
.logo-mark i { border-radius: 4.5px; }
.logo-mark i:nth-child(1) { background: #BFEBD9; }
.logo-mark i:nth-child(2) { background: var(--ok); }
.logo-mark i:nth-child(3) { background: var(--maybe); }
.logo-mark i:nth-child(4) { background: var(--accent); }
.logo-text {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.2;
  color: var(--accent);
  background: linear-gradient(115deg, #FF5F17 20%, #FF9A3D 80%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tagline {
  color: var(--dim);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  margin-top: 6px;
}
.tagline::before, .tagline::after {
  content: '';
  display: inline-block;
  width: 26px;
  height: 1.5px;
  background: #E8DCC8;
  vertical-align: middle;
  margin: 0 10px;
  border-radius: 1px;
}
/* 法的文書ページ */
.doc-card p, .doc-card li { font-size: 13px; line-height: 1.9; }
.doc-card h3 { font-size: 14px; margin: 20px 0 6px; }
.doc-note { font-size: 12px; color: var(--dim); }

/* cards */
.card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(160, 120, 60, 0.08);
  padding: 18px 20px;
  margin: 16px 0;
}
.card h2 {
  font-size: 16px; font-weight: 700; margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.card h2::before {
  content: '';
  width: 5px; height: 18px; border-radius: 3px;
  background: var(--accent); flex-shrink: 0;
}
.host-only-note { font-size: 12px; color: var(--dim); font-weight: 400; }

/* form */
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 12px;
}
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--dim); }
.field-wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea {
  font-family: inherit; font-size: 14px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px;
  padding: 8px 10px; background: #FFFDF9; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field input:disabled, .field select:disabled, .field textarea:disabled {
  background: var(--blank); color: var(--dim); cursor: not-allowed;
}
.field textarea { resize: vertical; }

.share-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* 曜日・祝日トグル */
.dow-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dow-btns { display: flex; gap: 4px; }
.dow-btn {
  font-family: inherit; font-size: 13px; font-weight: 700;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--line); background: #FFF; color: var(--dim);
  cursor: pointer; transition: background 0.1s, border-color 0.1s;
  display: inline-flex; align-items: center; justify-content: center;
}
.dow-btn.active { background: var(--accent); border-color: var(--accent); color: #FFF; }
.dow-btn.dow-btn-sun:not(.active) { color: var(--danger); }
.dow-btn.dow-btn-sat:not(.active) { color: #4A90D9; }
.dow-btn:disabled { cursor: not-allowed; opacity: 0.6; }
.dow-btn-holiday {
  width: auto; border-radius: 999px; padding: 0 14px; font-size: 12px;
}
.dow-btn-holiday.active { background: var(--danger); border-color: var(--danger); color: #FFF; }
.share-note { font-size: 11px; color: var(--dim); }

/* buttons */
.btn {
  font-family: inherit; font-size: 13px; font-weight: 700;
  border-radius: 999px; padding: 8px 16px; cursor: pointer;
  border: 1.5px solid transparent; transition: transform 0.05s;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--accent); color: #FFF; border-color: var(--accent); }
.btn-primary:hover { background: #FF8E4D; }
.btn-ghost { background: #FFF; color: var(--accent); border-color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-small { padding: 6px 12px; font-size: 12px; background: var(--ok); color: #FFF; border-color: var(--ok); }
.btn-small:hover { background: #45CFA0; }

/* 集計モード: タイトル行・参加者チップ */
.results-title-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.results-title-row h2 { margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.chips-empty { font-size: 13px; color: var(--dim); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--line); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; cursor: pointer; background: #FFF;
  user-select: none;
  transition: border-color 0.1s, background 0.1s;
}
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.chip .chip-x {
  border: none; background: none; cursor: pointer; color: var(--dim);
  font-size: 12px; padding: 0 2px; line-height: 1;
}
.chip .chip-x:hover { color: var(--danger); }

/* 入力モード */
.draft-badge {
  font-size: 11px; font-weight: 700;
  background: var(--maybe-soft); color: #9A7100;
  border-radius: 999px; padding: 4px 12px;
}
.name-row { max-width: 300px; margin-bottom: 10px; }
.save-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 16px;
}

/* toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.tools { display: flex; gap: 6px; }
.tool-btn {
  font-family: inherit; font-size: 13px; font-weight: 700;
  border-radius: 999px; padding: 7px 14px; cursor: pointer;
  border: 1.5px solid var(--line); background: #FFF; color: var(--dim);
}
.tool-btn.tool-ok.active { background: var(--ok); border-color: var(--ok); color: #FFF; }
.tool-btn.tool-maybe.active { background: var(--maybe); border-color: var(--maybe); color: #7A5A00; }
.tool-btn.tool-ng.active { background: #B9AE9C; border-color: #B9AE9C; color: #FFF; }

.hint { font-size: 12px; color: var(--dim); margin: 4px 0 10px; }
.hint b { color: var(--accent); }

/* paint extras: みんなに合わせて○ / 透かし表示トグル */
.paint-extras {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin: 2px 0 8px;
}
.btn-match {
  font-family: inherit; font-size: 13px; font-weight: 800;
  border-radius: 999px; padding: 8px 18px; cursor: pointer;
  color: #FFF; border: none;
  background: linear-gradient(90deg, var(--ok), #4DC9E8);
  box-shadow: 0 3px 10px rgba(47, 191, 143, 0.35);
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform 0.05s;
}
.btn-match:active { transform: scale(0.96); }
.btn-match:hover { filter: brightness(1.06); }
.btn-match-sub {
  font-size: 10px; font-weight: 700;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px; padding: 2px 8px;
}
.ghost-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--dim); cursor: pointer; user-select: none;
}
.ghost-toggle input { accent-color: var(--accent); cursor: pointer; }
.cell.ghost-full { box-shadow: inset 0 0 0 1.5px rgba(255, 122, 47, 0.55); }

/* grid */
.grid-scroll { overflow-x: auto; border-radius: 12px; border: 1.5px solid var(--line); background: #FFFDF9; }
.grid {
  display: grid;
  gap: 2px;
  padding: 6px;
  user-select: none;
  -webkit-user-select: none;
  min-width: fit-content;
}
.corner { position: sticky; left: 0; z-index: 3; background: #FFFDF9; }
.hour-head {
  grid-column: span 2;
  font-size: 11px; font-weight: 700; color: var(--dim); text-align: left;
  padding: 2px 0 2px 7px; cursor: pointer; border-radius: 6px;
}
.hour-head:hover { background: var(--accent-soft); color: var(--accent); }
.row-head {
  position: sticky; left: 0; z-index: 2;
  background: #FFFDF9;
  font-size: 12px; font-weight: 700;
  padding: 0 10px 0 4px; cursor: pointer;
  display: flex; align-items: center; white-space: nowrap;
  border-radius: 6px;
}
.row-head:hover { background: var(--accent-soft); color: var(--accent); }
.row-head .dow { font-size: 10px; color: var(--dim); margin-left: 3px; }
.row-head .dow.sat { color: #4A90D9; }
.row-head .dow.sun { color: var(--danger); }
.cell {
  height: 30px; min-width: 26px;
  border-radius: 5px;
  background: var(--blank);
  cursor: pointer;
  touch-action: none;
  position: relative;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.cell.v2 { background: var(--ok); }
.cell.v1 {
  background: repeating-linear-gradient(45deg, var(--maybe), var(--maybe) 4px, var(--maybe-soft) 4px, var(--maybe-soft) 8px);
}
.cell.preview { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 1; }
/* 1時間ごとの縦区切り線（:00セルの左に引く） */
.cell.hour-start::before {
  content: '';
  position: absolute;
  left: -2px; top: -2px; bottom: -2px;
  width: 2px;
  background: #E3D6BF;
  pointer-events: none;
}
/* 同じ状態の隣接マスを結合表示（角を落とし、2pxの隙間を埋める） */
.cell.join-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -2px; }
.cell.join-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cell.join-t { border-top-left-radius: 0; border-top-right-radius: 0; }
.cell.join-b { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.cell.join-t::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: -2px; height: 2px;
  background: inherit;
  pointer-events: none;
}
/* 結合で隙間が消えても時間区切り線は境界に残す */
.cell.join-l.hour-start::before { left: 0; }
.cell.join-t::after { z-index: 0; }
.cell .heat-num { position: relative; z-index: 1; padding-left: 2px; }

/* 週の変わり目の横区切り */
.week-sep {
  grid-column: 1 / -1;
  height: 3px;
  background: #EADDC5;
  border-radius: 2px;
  margin: 2px 0;
}
.cell.heat-full { background: var(--accent); color: #FFF; }
.cell.best1 { outline: 2.5px solid var(--accent); outline-offset: -1px; z-index: 1; }
/* 集計モードは塗り操作がないので、タッチでそのままスクロールできるようにする */
.grid.heatmode .cell { cursor: default; touch-action: auto; }
.heat-num { color: rgba(74, 63, 51, 0.75); }
.heat-full .heat-num { color: #FFF; }

.grid-note { font-size: 11px; color: var(--dim); margin: 6px 2px 0; }

/* best list */
.best-item {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 8px; font-size: 14px;
}
.best-item.rank1 { border-color: var(--accent); background: #FFF7F0; }
.best-rank { font-weight: 800; color: var(--accent); font-size: 15px; }
.best-time b { color: var(--accent); }
.badge {
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px;
}
.badge-ok { background: var(--ok-soft); color: #1D8A66; }
.badge-maybe { background: var(--maybe-soft); color: #9A7100; }
.badge-ng { background: #F3EEE5; color: #A89A85; }
.best-empty {
  border: 1.5px dashed var(--line); border-radius: 12px;
  padding: 16px; font-size: 13px; color: var(--dim);
}
.best-actions { margin-top: 10px; }

/* ad placeholder */
.ad-placeholder {
  border: 2px dashed #E5D8C2; border-radius: 12px;
  text-align: center; padding: 22px; margin: 16px 0;
  color: #C9BBA2; font-size: 12px; letter-spacing: 0.1em; font-weight: 700;
}

/* side ad rails (フルスクリーン時の左右あまり部分) */
.ad-rail {
  display: none;
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 160px; height: 600px;
  border: 2px dashed #E5D8C2; border-radius: 12px;
  color: #C9BBA2; font-size: 11px; letter-spacing: 0.1em; font-weight: 700;
  text-align: center; line-height: 600px;
  z-index: 1;
}
.ad-rail-left { left: calc(50% - 660px); }
.ad-rail-right { right: calc(50% - 660px); }
@media (min-width: 1340px) {
  .ad-rail { display: block; }
}

/* landing: hero */
.hero { padding: 8px 0 4px; }
.hero-banner {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, #FF8038 0%, #FF9A4D 55%, #FFB25C 100%);
  border-radius: 24px;
  box-shadow: 0 10px 28px rgba(255, 122, 47, 0.28);
  padding: 34px 34px 30px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  color: #FFF;
}
.hero-banner::before, .hero-banner::after {
  content: '';
  position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}
.hero-banner::before { width: 220px; height: 220px; top: -90px; left: -60px; }
.hero-banner::after { width: 320px; height: 320px; bottom: -180px; right: -80px; }
.hero-copy { position: relative; z-index: 1; }
.hero-kicker {
  display: inline-block;
  font-size: 11px; font-weight: 800; letter-spacing: 0.12em;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px; padding: 4px 14px; margin-bottom: 12px;
}
.hero-banner h1 {
  font-size: 27px; font-weight: 800; line-height: 1.55; margin: 0 0 10px;
  text-shadow: 0 2px 6px rgba(180, 70, 0, 0.25);
}
.marker {
  background: linear-gradient(transparent 62%, rgba(255, 220, 90, 0.95) 62%);
  padding: 0 2px;
}
.hero-banner p { font-size: 14px; margin: 0; opacity: 0.95; line-height: 1.9; }
.pc-only { display: none; }
@media (min-width: 640px) { .pc-only { display: inline; } }

/* hero: ミニ出欠表イラスト（CSSのみ） */
.hero-visual { position: relative; z-index: 1; flex-shrink: 0; }
.mini-card {
  position: relative;
  background: #FFFDF9;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(140, 60, 0, 0.3);
  transform: rotate(3deg);
}
.mini-grid { display: grid; grid-template-columns: repeat(8, 18px); gap: 3px; }
.mg { width: 18px; height: 18px; border-radius: 4px; background: #F3ECDF; }
.mg.m { background: #BFEBD9; }
.mg.M { background: #62D4A9; }
.mg.o { background: var(--accent); }
.mini-badge {
  position: absolute; right: -12px; bottom: -12px;
  background: var(--accent); color: #FFF;
  font-size: 11px; font-weight: 800;
  border-radius: 999px; padding: 5px 12px;
  border: 2.5px solid #FFFDF9;
  box-shadow: 0 4px 10px rgba(140, 60, 0, 0.3);
  transform: rotate(-3deg);
  white-space: nowrap;
}
@media (max-width: 720px) {
  .hero-banner { flex-direction: column; text-align: center; padding: 28px 20px 34px; }
  .hero-banner h1 { font-size: 21px; }
}

/* landing: create */
.create-card { border: 2px solid var(--accent-soft); }
.create-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.btn-big { font-size: 16px; padding: 12px 32px; }

/* landing: sections */
.section-title {
  text-align: center; font-size: 20px; font-weight: 800; margin: 34px 0 16px;
}
.steps-more { text-align: center; margin: -8px 0 14px; font-size: 13px; }
.step-row, .feature-row { display: grid; gap: 12px; }
.step-row { grid-template-columns: repeat(3, 1fr); }
.feature-row { grid-template-columns: repeat(2, 1fr); }
.step-card, .feature-card {
  background: var(--card); border-radius: 16px;
  box-shadow: 0 4px 16px rgba(160, 120, 60, 0.08);
  padding: 16px 18px;
}
.step-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #FFF;
  font-size: 16px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.step-card h3, .feature-card h3 { font-size: 14px; font-weight: 700; margin: 0 0 6px; }
.feature-card h3 { color: var(--accent); }
.step-card p, .feature-card p { font-size: 12px; color: var(--dim); margin: 0; }

/* footer links */
.footer-links { margin-bottom: 4px; }
.footer-link { color: var(--dim); font-size: 12px; }
.footer-link:hover { color: var(--accent); }

@media (max-width: 640px) {
  .step-row, .feature-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 19px; }
}

/* footer */
.site-footer { text-align: center; padding: 10px 0 30px; font-size: 12px; color: var(--dim); }
.link-btn {
  font-family: inherit; border: none; background: none; cursor: pointer;
  color: var(--dim); font-size: 12px; text-decoration: underline;
}
.link-btn:hover { color: var(--accent); }
.sep { margin: 0 8px; }
.copyright { margin-top: 8px; font-size: 11px; }

/* 決定バナー */
.confirm-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(90deg, var(--ok), #4DC9A8);
  color: #FFF;
  border-radius: 16px;
  padding: 16px 22px;
  margin: 16px 0 0;
  box-shadow: 0 6px 18px rgba(47, 191, 143, 0.35);
}
.confirm-label { font-size: 15px; font-weight: 800; letter-spacing: 0.04em; }
.confirm-time { font-size: 16px; }
.confirm-time b { font-size: 20px; }
.confirm-cancel { color: rgba(255, 255, 255, 0.85); margin-left: auto; }
.confirm-cancel:hover { color: #FFF; }

/* ランキングの決定ボタン（幹事のみ） */
.best-decide {
  font-family: inherit; font-size: 12px; font-weight: 700;
  border: 1.5px solid var(--ok); color: var(--ok); background: #FFF;
  border-radius: 999px; padding: 4px 12px; cursor: pointer;
  margin-left: auto;
  transition: background 0.1s, color 0.1s;
}
.best-decide:hover { background: var(--ok); color: #FFF; }

/* 備考 */
.notes-list { margin: -2px 0 8px; }
.note-line { font-size: 12px; color: var(--dim); line-height: 1.8; }
.note-name {
  font-weight: 700; color: var(--ink);
  margin-right: 6px;
}
.note-name::after { content: ':'; margin-left: 1px; color: var(--dim); }
.note-row { margin-top: 12px; }

/* cell tooltip（集計マスのホバー詳細） */
.cell-tip {
  position: fixed;
  background: rgba(74, 63, 51, 0.95);
  color: #FFF;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.7;
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}
.tip-head { font-weight: 700; font-size: 11px; opacity: 0.85; margin-bottom: 2px; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-sym { font-weight: 800; width: 14px; text-align: center; }
.tip-ok { color: #7FE8C5; }
.tip-maybe { color: #FFD35C; }
.tip-ng { color: #B9AE9C; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #FFF; font-size: 13px; font-weight: 700;
  border-radius: 999px; padding: 10px 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2); z-index: 10;
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .logo { font-size: 28px; }
}
