/* Mellow-Art チケット管理 共通スタイル */
:root {
  --paper: #F6EEDF;
  --card: #FFF9EE;
  --ink: #3B2A20;
  --ink-2: #5E4A3C;
  --muted: #6B5646;
  --line: #D9C3A0;
  --tan: #C9905A;
  --gold: #E6BF72;
  --brick: #8F3F2B;
  --brick-dark: #5E2718;
  --red: #A33A22;
  --green: #3E6B45;
  --p1: #8C5E12;
  --p2: #8F3F2B;
  --gray-stamp: #7A6A5C;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif;
  color: var(--ink);
  background-color: var(--paper);
  background-image: repeating-linear-gradient(0deg, transparent 0 31px, rgba(150, 110, 70, .10) 31px 32px);
  min-height: 100vh;
}
a { color: var(--brick); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
[hidden] { display: none !important; }
img { max-width: 100%; }

.hand { font-family: "Yomogi", cursive; }
.logo { font-family: "M PLUS Rounded 1c", sans-serif; font-weight: 800; }
.plaid {
  background-color: #C99434;
  background-image:
    repeating-linear-gradient(90deg, rgba(110, 55, 20, .30) 0 5px, transparent 5px 18px, rgba(255, 244, 214, .40) 18px 19px, transparent 19px 34px),
    repeating-linear-gradient(0deg, rgba(110, 55, 20, .30) 0 5px, transparent 5px 18px, rgba(255, 244, 214, .40) 18px 19px, transparent 19px 34px);
}
.stub {
  -webkit-mask: radial-gradient(circle 9px at 0 50%, transparent 97%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 9px at 100% 50%, transparent 97%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle 9px at 0 50%, transparent 97%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 9px at 100% 50%, transparent 97%, #000) right / 51% 100% no-repeat;
}

.wrap { max-width: 480px; margin: 0 auto; position: relative; overflow: hidden; padding-bottom: 40px; }
.leaf { position: absolute; pointer-events: none; }

/* ---------- ヘッダー ---------- */
.flyer { padding: 20px 16px 0; position: relative; }
.flyer-frame { padding: 6px; background: var(--card); border-radius: 4px; box-shadow: 0 3px 0 rgba(90, 55, 30, .18); }
.flyer-frame img { display: block; width: 100%; height: auto; }
.tape { position: absolute; top: 10px; width: 64px; height: 20px; background: rgba(233, 200, 130, .85); }
.tape.l { left: 28px; transform: rotate(-6deg); }
.tape.r { right: 28px; transform: rotate(5deg); }

.title-block { padding: 18px 22px 0; display: flex; flex-direction: column; gap: 2px; }
.title-block .tag { font-size: 15px; color: var(--brick); }
.title-block h1 { margin: 0; font-size: 32px; letter-spacing: .02em; text-shadow: 2px 2px 0 var(--gold); }
.title-block .sub { font-size: 15px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }
.official {
  align-self: flex-start; margin-top: 10px; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--ink); color: #FBEFD9;
  text-decoration: none; font-size: 13px; font-weight: 700;
}

main.form { padding: 18px 20px 0; display: flex; flex-direction: column; gap: 20px; }
.label { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.err { font-size: 12px; color: var(--red); font-weight: 700; line-height: 1.6; }
.ok { font-size: 12px; color: var(--green); font-weight: 700; }

/* ---------- 公演チケット ---------- */
.event-stub { display: flex; min-height: 112px; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 0 rgba(90, 55, 30, .18); }
.event-stub .date { width: 96px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.event-stub .date span { background: var(--ink); color: #FBEFD9; padding: 4px 8px; border-radius: 6px; font-size: 18px; line-height: 1.15; text-align: center; }
.event-stub .date small { font-size: 12px; letter-spacing: .1em; }
.event-stub .body { flex: 1; background: var(--card); border-left: 2px dashed var(--line); padding: 12px 18px 12px 14px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.event-stub .venue { font-size: 19px; }
.event-stub .times { font-size: 12px; color: var(--ink-2); }
.event-stub .deadline { font-size: 12px; color: var(--brick); font-weight: 700; }
.link-btn { background: none; border: 0; color: var(--brick); font-weight: 700; font-size: 13px; padding: 8px 2px; align-self: flex-end; }

/* ---------- 部の選択 ---------- */
.parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.part-btn {
  position: relative; min-height: 84px; border-radius: 14px; border: 2px solid var(--line); background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px;
}
.part-btn .name { font-size: 24px; }
.part-btn .time { font-size: 11px; color: var(--muted); }
.part-btn.p1 .name { color: var(--p1); }
.part-btn.p2 .name { color: var(--p2); }
.part-btn.on { border-color: var(--ink); color: #fff; box-shadow: 3px 3px 0 var(--ink); }
.part-btn.on.p1 { background: var(--p1); }
.part-btn.on.p2 { background: var(--p2); }
.part-btn.on .name { color: #fff; }
.part-btn.on .time { color: #F6E2D2; }
.part-btn .check { position: absolute; top: 8px; right: 8px; display: none; }
.part-btn.on .check { display: block; }

/* ---------- 入力 ---------- */
.field {
  display: flex; align-items: center; height: 50px; padding: 0 16px; background: var(--card);
  border: 2px solid var(--ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--gold);
}
.field input { border: 0; outline: 0; background: transparent; font-size: 16px; flex: 1; min-width: 0; padding-left: 2px; }
.field .at { font-size: 16px; color: #8A7462; }

.upload-btn { width: 100%; height: 64px; border-radius: 14px; border: 0; background: var(--tan); padding: 5px; }
.upload-btn > span {
  height: 100%; border: 1.5px dashed #FBEFD9; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  gap: 8px; color: #fff; font-size: 15px; font-weight: 700;
}

/* ---------- 画像カード ---------- */
.img-card {
  position: relative; background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 16px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: 4px 4px 0 var(--tan);
}
.img-card .tape-c { position: absolute; top: -12px; left: 50%; margin-left: -34px; width: 68px; height: 22px; background: rgba(233, 200, 130, .85); transform: rotate(-3deg); }
.img-card .head { display: flex; gap: 14px; align-items: flex-start; }
.img-card .thumb { width: 70px; height: 108px; flex-shrink: 0; border-radius: 8px; object-fit: cover; background: #E6D7BF; border: 1.5px solid #CDB793; }
.img-card .info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.img-card .remove { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; }
.status-line { font-size: 16px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--brick); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

.ticket-row { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 2px dotted var(--line); }
.ticket-row .no-line { display: flex; align-items: center; gap: 10px; }
.ticket-row .bar { width: 8px; height: 30px; border-radius: 4px; flex-shrink: 0; }
.ticket-row .no-input {
  width: 110px; height: 44px; border: 2px solid var(--line); border-radius: 10px; background: #fff; padding: 0 10px;
  font-family: "M PLUS Rounded 1c", sans-serif; font-weight: 800; font-size: 24px; text-transform: uppercase;
}
.ticket-row .del { margin-left: auto; min-height: 36px; border: 0; background: none; color: var(--red); font-size: 12px; font-weight: 700; }
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chip { min-height: 42px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: 14px; font-weight: 700; color: #4A3A2E; padding: 0 4px; }
.chip.on { border-color: var(--brick); background: var(--brick); color: #fff; }
.add-row { align-self: flex-start; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 2px dashed var(--line); background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 700; }
.bulk-member { background: var(--card); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; border: 2px dashed var(--line); }

.submit {
  height: 58px; border: 0; border-radius: 16px; background: var(--brick); padding: 5px; box-shadow: 0 4px 0 var(--brick-dark); width: 100%;
}
.submit > span {
  height: 100%; border: 1.5px dashed #F2C9B8; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px; letter-spacing: .04em;
}

/* ---------- 履歴 ---------- */
.history-head { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.history-head h2 { margin: 0; font-size: 21px; }
.history-head .note { margin-left: auto; font-size: 13px; color: var(--muted); }
.group-head { display: flex; align-items: center; gap: 10px; margin: 8px 0 10px; }
.part-tag { font-size: 16px; color: #fff; padding: 4px 12px; border-radius: 8px; }
.part-tag.p1 { background: var(--p1); }
.part-tag.p2 { background: var(--p2); }
.group-head .rule { flex: 1; border-top: 2px dotted var(--line); }
.event-label { font-size: 14px; font-weight: 700; color: var(--ink-2); margin-top: 6px; }
.h-item { display: flex; align-items: center; min-height: 84px; background: var(--card); border-radius: 10px; margin-bottom: 10px; box-shadow: 0 2px 0 rgba(90, 55, 30, .15); }
.h-item .side { width: 14px; align-self: stretch; flex-shrink: 0; }
.h-item .main { flex: 1; padding: 12px 8px 12px 16px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.h-item .no { font-size: 22px; line-height: 1.1; }
.h-item .sub { font-size: 12px; color: var(--muted); }
.h-item .memo { font-size: 13px; color: var(--brick); }
.h-item .stamp-wrap { padding-right: 18px; flex-shrink: 0; }
.stamp {
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  min-height: 30px; padding: 4px 12px; border-radius: 999px; border: 2px solid currentColor;
  font-size: 13px; font-weight: 700; line-height: 1.2;
}
.stamp.valid { color: var(--green); background: #E3F1E8; }
.stamp.pending { color: #5A4F46; background: #EFE9E0; border-color: #CDBFAE; }
.stamp.invalid { color: var(--red); background: #F8E4DE; }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 18px 0; }

footer.foot { margin: 28px 20px 0; padding: 16px 0 60px; border-top: 2px dotted var(--line); text-align: center; font-size: 13px; color: var(--ink-2); line-height: 1.8; }

/* ---------- 閉じている状態 ---------- */
.closed-box { background: var(--card); border: 2px solid var(--red); border-radius: 14px; padding: 16px; text-align: center; color: var(--red); font-weight: 700; line-height: 1.7; }

/* ---------- シート・トースト ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(40, 25, 15, .55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; background: var(--paper); border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px;
}
.sheet h3 { margin: 0; font-size: 19px; }
.sheet-item { text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 52px; }
.sheet-item.on { border-color: var(--ink); }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: #FBEFD9; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 700;
  max-width: calc(100% - 32px); box-shadow: 0 4px 0 rgba(0, 0, 0, .2); line-height: 1.5;
}
.toast.error { background: var(--red); color: #fff; }
.demo-bar { background: var(--gold); color: var(--ink); text-align: center; font-size: 12px; font-weight: 700; padding: 6px 10px; }

.btn { min-height: 46px; border-radius: 12px; border: 2px solid var(--ink); background: var(--card); font-size: 14px; font-weight: 700; padding: 0 14px; box-shadow: 2px 2px 0 var(--ink); }
.btn.primary { background: var(--brick); color: #fff; }
.btn.green { background: var(--green); color: #fff; }
.btn.gold { background: var(--gold); }
.btn.ghost { border-color: var(--line); box-shadow: none; }
.btn.danger { border-color: var(--red); color: var(--red); box-shadow: none; }
.pill { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); font-size: 13px; font-weight: 700; color: #4A3A2E; }
.pill.on { border-color: var(--ink); background: var(--ink); color: #FBEFD9; }
.pill.warn { color: var(--red); }
.pill.warn.on { background: var(--red); border-color: var(--red); color: #fff; }

/* =====================================================================
   管理画面
   ===================================================================== */
.admin-head { background: var(--ink); color: #FBEFD9; padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.admin-head .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid rgba(251, 239, 217, .6); background: rgba(251, 239, 217, .12); display: flex; align-items: center; justify-content: center; color: #FBEFD9; flex-shrink: 0; }
.ev-box { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: rgba(251, 239, 217, .10); border: 1.5px dashed rgba(251, 239, 217, .55); width: 100%; text-align: left; color: #FBEFD9; }
.ev-box img { width: 112px; height: auto; border: 3px solid var(--card); border-radius: 3px; flex-shrink: 0; display: block; }
.ev-box .t { font-size: 15px; font-weight: 700; }
.ev-box .s { font-size: 13px; color: var(--gold); }

.part-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 14px 16px 0; }
.part-tab { min-height: 72px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.part-tab .n { font-size: 22px; }
.part-tab .c { font-size: 12px; color: var(--muted); }
.part-tab.p1 .n { color: var(--p1); }
.part-tab.p2 .n { color: var(--p2); }
.part-tab.on { border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); color: #fff; }
.part-tab.on.p1 { background: var(--p1); }
.part-tab.on.p2 { background: var(--p2); }
.part-tab.on .n { color: #fff; }
.part-tab.on .c { color: #F6E6C8; }

main.admin { padding: 16px 16px 160px; display: flex; flex-direction: column; gap: 14px; }
.sec-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-title .bar { width: 8px; height: 26px; border-radius: 4px; }
.sec-title h2 { margin: 0; font-size: 20px; }
.counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.count { background: var(--card); border: 2px solid var(--ink); border-radius: 12px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; }
.count .k { font-size: 11px; font-weight: 700; color: var(--muted); }
.count .v { font-size: 22px; }
.count.alert { background: var(--red); color: #fff; box-shadow: 3px 3px 0 var(--ink); }
.count.alert .k { color: #fff; }
.by-member { background: var(--card); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.by-member .grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px; font-size: 13px; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.t-row { display: flex; align-items: center; gap: 10px; min-height: 84px; background: var(--card); border-radius: 10px; box-shadow: 0 2px 0 rgba(90, 55, 30, .15); }
.t-row.warn { background: #FBE9DF; }
.t-row .side { width: 10px; align-self: stretch; flex-shrink: 0; }
.t-row input[type=checkbox] { width: 22px; height: 22px; flex-shrink: 0; margin-left: 8px; accent-color: var(--brick); }
.t-row .thumb { width: 60px; height: 88px; flex-shrink: 0; border-radius: 6px; background: #E6D7BF; border: 1px solid #CDB793; object-fit: cover; }
.t-row .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; background: none; border: 0; text-align: left; padding: 8px 0; }
.t-row .no { font-size: 22px; line-height: 1.1; }
.t-row .mem { font-size: 12px; font-weight: 700; color: var(--brick); margin-left: 8px; }
.t-row .tw { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-row .w { font-size: 12px; color: var(--red); }
.t-row .stamp-wrap { padding-right: 16px; flex-shrink: 0; }

.action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; }
.action-bar .inner { max-width: 480px; margin: 0 auto; background: var(--card); padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.action-bar .btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.detail-img { width: 100%; border-radius: 10px; border: 2px solid var(--line); background: #E6D7BF; min-height: 200px; display: block; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label, .form-row .lab { font-size: 13px; font-weight: 700; color: var(--muted); }
.input { height: 46px; border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 0 12px; font-size: 15px; width: 100%; }
textarea.input { height: 80px; padding: 10px 12px; resize: vertical; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.seg.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg button { min-height: 44px; border-radius: 10px; border: 2px solid var(--line); background: var(--card); font-weight: 700; }
.seg button.on { border-color: var(--ink); background: var(--ink); color: #FBEFD9; }
.warn-box { background: #FBE9DF; border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--red); line-height: 1.6; }

.login { max-width: 420px; margin: 40px auto; padding: 0 20px; display: flex; flex-direction: column; gap: 14px; }
.card { position: relative; background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 18px 16px 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: 4px 4px 0 var(--tan); }
.card.dim { background: #EADCC4; border-color: var(--line); box-shadow: none; }
.badge { font-size: 13px; border: 2px solid currentColor; border-radius: 999px; padding: 2px 10px; display: inline-block; font-weight: 700; white-space: nowrap; }
.badge.open { color: var(--green); }
.badge.stopped { color: var(--red); }
.badge.ended { color: var(--gray-stamp); }
.member-row { display: flex; align-items: center; gap: 6px; min-height: 54px; border-bottom: 2px dotted #E2D2B8; }
.member-row:last-child { border-bottom: 0; }
.member-row .name { flex: 1; font-size: 16px; font-weight: 700; }
.small-btn { width: 40px; height: 40px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; border-radius: 10px; }
.check-row { display: flex; gap: 18px; font-size: 15px; font-weight: 700; }
.check-row label { display: flex; align-items: center; gap: 6px; }
.check-row input { width: 20px; height: 20px; accent-color: var(--brick); }

/* 「あなたの登録」の画像サムネイル */
.h-thumb { flex-shrink: 0; width: 46px; height: 66px; margin-left: 12px; padding: 0; border: 1.5px solid #CDB793; border-radius: 6px; background: #E6D7BF; overflow: hidden; }
.h-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.h-item .h-thumb + .main { padding-left: 12px; }

/* 有効番号の発表ページ */
.num-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.num {
  min-height: 52px; border-radius: 10px; background: var(--card); border: 2px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 20px; line-height: 1.1;
}
.num small { font-size: 10px; font-weight: 700; margin-top: 2px; }
.num.mine { color: #fff; border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.num.mine.p1 { background: var(--p1); }
.num.mine.p2 { background: var(--p2); }
.my-note { background: var(--card); border: 2px dashed var(--tan); border-radius: 12px; padding: 10px 14px; font-size: 15px; color: var(--brick); text-align: center; }
.results-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; text-decoration: none;
  background: var(--ink); color: #FBEFD9; border-radius: 14px; padding: 14px 16px; font-weight: 700; box-shadow: 3px 3px 0 var(--gold);
}
.results-banner small { display: block; font-size: 12px; color: var(--gold); font-weight: 500; margin-top: 2px; }
.img-card.bad { border-color: var(--red); box-shadow: 4px 4px 0 #D9A08E; }
