@charset "utf-8";

:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: #2d2118;
  background: #fbf4e4;
  --paper: #fbf4e4;
  --ticket: #fffaf0;
  --red: #a93425;
  --red-dark: #862616;
  --ink: #2d2118;
  --muted: #6e5342;
  --stroke: #d8b899;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button { font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:focus-visible { outline: 3px solid #2d2118; outline-offset: 4px; }
.shell { width: min(1100px, calc(100% - 80px)); margin: 0 auto; padding-bottom: 54px; }

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--stroke);
}
.brand { display: flex; align-items: center; gap: 11px; font-size: 1rem; font-weight: 750; }
.dice {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: inline-block;
  border-radius: 6px;
  background:
    radial-gradient(circle at 29% 29%, var(--dot) 0 9%, transparent 10%),
    radial-gradient(circle at 50% 50%, var(--dot) 0 9%, transparent 10%),
    radial-gradient(circle at 71% 71%, var(--dot) 0 9%, transparent 10%),
    var(--die);
  transform: rotate(-10deg);
}
.dice--brand { --dot: #fffaf0; --die: var(--red); }
.dice--action { --dot: var(--red); --die: #fffaf0; }

.list-button, .close-button {
  border: 1px solid var(--stroke);
  color: var(--ink);
  background: var(--ticket);
  border-radius: 8px;
  min-height: 44px;
}
.list-button { display: flex; align-items: center; gap: 8px; padding: 0 13px; font-size: .875rem; font-weight: 650; }
.list-icon {
  display: block;
  width: 14px;
  height: 10px;
  border-block: 1px solid currentColor;
  background: linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat;
}
.list-button:hover, .close-button:hover { background-color: #f9ead3; }

.intro { padding: 44px 0 30px; }
h1 {
  margin: 0;
  font-size: clamp(3rem, 7.3vw, 6.25rem);
  font-weight: 900;
  letter-spacing: -.035em;
  line-height: 1.1;
}
h1 span { color: var(--red); }

.table { display: grid; grid-template-columns: 1.08fr 1fr; gap: 18px; }
.ticket {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: var(--ticket);
  box-shadow: 0 8px 20px #67391c0b;
}
.ticket-main { display: flex; flex: 1; flex-direction: column; padding: 24px 28px 0; }
.ticket-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  font-size: 1rem;
  font-weight: 700;
}
.option-count { font-size: .875rem; color: var(--muted); font-weight: 500; }
.option-count strong { font-variant-numeric: tabular-nums; }
.ticket-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
.category-control { min-width: 0; display: flex; align-items: center; gap: 9px; font-size: .875rem; font-weight: 650; }
.category-control > label { flex: none; }
.select-wrap { position: relative; min-width: 0; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.field-select, .add-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--ticket);
  color: var(--ink);
  font: inherit;
}
.field-select { appearance: none; padding: 0 28px 0 11px; cursor: pointer; }
.field-select:focus-visible, .add-form input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.add-button { flex: none; color: var(--red-dark); gap: 5px; white-space: nowrap; }
.add-button > span { font-size: 1.25rem; line-height: 1; }
.add-button:disabled, .field-select:disabled { opacity: .65; cursor: wait; }
.draw-result {
  flex: 1;
  min-height: 180px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  container-type: inline-size;
  overflow: hidden;
  padding: 18px 4px 25px;
  text-align: center;
}
.result-name {
  grid-area: 1 / 1;
  max-width: 100%;
  font-size: clamp(2.2rem, 4.6vw, 4rem);
  font-size: clamp(1rem, calc(97cqi / var(--name-units, 4)), clamp(2.2rem, 4.6vw, 4rem));
  font-weight: 900;
  line-height: 1.19;
  letter-spacing: -.025em;
  color: var(--muted);
  white-space: nowrap;
  padding-block: .04em;
}
.result-name, .menu-list li > span {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.result-name::-webkit-scrollbar, .menu-list li > span::-webkit-scrollbar { display: none; }
.draw-result.has-draw .result-name { color: var(--red); }
.result-name--previous { opacity: 0; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ticket-stub {
  position: relative;
  border-top: 1px dashed var(--stroke);
  padding: 21px 28px 24px;
}
.ticket-stub::before, .ticket-stub::after {
  content: "";
  position: absolute;
  top: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--paper);
  pointer-events: none;
}
.ticket-stub::before { left: -10px; border-right: 1px solid var(--stroke); }
.ticket-stub::after { right: -10px; border-left: 1px solid var(--stroke); }

.draw-button {
  width: 100%;
  min-height: 60px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  border: 1px solid var(--red-dark);
  border-radius: 9px;
  background: var(--red);
  color: #fffaf0;
  box-shadow: 0 3px 0 var(--red-dark);
  font-size: 1.15rem;
  font-weight: 800;
}
.draw-button:hover { background: var(--red-dark); }
.draw-button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--red-dark); }
.draw-button:disabled { opacity: .55; }
.draw-button[aria-disabled="true"] { cursor: wait; background: var(--red-dark); transform: none; }

.food-photo { margin: 0; position: relative; min-height: 388px; border-radius: 16px; overflow: hidden; background: #d98938; }
.food-photo img { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 49%; }

dialog {
  width: min(540px, calc(100% - 28px));
  max-height: 85vh;
  max-height: 85dvh;
  padding: 0;
  background: var(--ticket);
  color: var(--ink);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  box-shadow: 0 16px 45px #2d211842;
}
dialog::backdrop { background: #2d21187d; }
.dialog-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  position: sticky;
  top: 0;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--stroke);
  background: var(--ticket);
}
.dialog-heading h2 { font-size: 1.35rem; margin: 0; }
.dialog-heading p { font-size: .875rem; margin: 5px 0 0; color: var(--muted); }
.close-button { width: 44px; font-size: 1.65rem; line-height: 1; }
.menu-list { padding: 0 20px 10px; list-style: none; margin: 0; }
.menu-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #ebdbc7;
  padding: 11px 2px;
  white-space: nowrap;
}
.menu-list li > span { min-width: 0; }
.menu-list li small { flex: none; color: var(--muted); font-size: .875rem; }
.add-form { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 23px; }
.add-form label { font-size: .875rem; font-weight: 700; }
.add-form label:not(:first-child) { margin-top: 7px; }
.add-form input { padding: 0 11px; }
.form-error { color: var(--red-dark); font-size: .875rem; margin: 0; }
.save-button { margin-top: 8px; min-height: 48px; font-size: 1rem; }
.notice:not(:empty) {
  position: fixed;
  z-index: 2;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--ticket);
  font-size: .9375rem;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .shell { width: calc(100% - 36px); padding-bottom: 30px; }
  .topbar { min-height: 64px; }
  .intro { padding: 32px 0 23px; }
  .table { grid-template-columns: 1fr; gap: 16px; }
  .ticket-main { padding: 19px 20px 0; }
  .draw-result { min-height: 142px; padding: 16px 0 20px; }
  .ticket-stub { padding: 16px 20px 19px; }
  .draw-button { min-height: 54px; }
  .food-photo { width: 100%; min-width: 0; min-height: 200px; aspect-ratio: 1.58; }
}

@media (max-width: 359px) {
  h1 { font-size: 2.65rem; }
  .brand { font-size: .875rem; gap: 8px; }
  .list-button { padding-inline: 9px; }
  .ticket-controls { gap: 8px; }
  .category-control { gap: 6px; }
}