:root {
  --bg: #f6f3ea;
  --card: #fffcf4;
  --ink: #1e2a2a;
  --accent: #0f766e;
  --accent-2: #c2410c;
  --muted: #5f6b69;
  --line: #d5d0c3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 80% 20%, #e8f8ef 0%, transparent 40%),
    radial-gradient(circle at 10% 80%, #fde6cc 0%, transparent 35%),
    var(--bg);
}

.bg-shape {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  opacity: 0.35;
  filter: blur(26px);
}

.bg-shape-a {
  width: 240px;
  height: 240px;
  right: -80px;
  top: -80px;
  background: #86efac;
}

.bg-shape-b {
  width: 280px;
  height: 280px;
  left: -120px;
  bottom: -120px;
  background: #fdba74;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: color-mix(in srgb, #fffcf4 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.topbar h1 a {
  color: inherit;
  text-decoration: none;
}

.actions {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.container {
  max-width: 960px;
  margin: 20px auto;
  padding: 0 14px 40px;
  display: grid;
  gap: 14px;
}

.footer-links {
  max-width: 960px;
  margin: 0 auto 24px;
  padding: 0 14px;
}

.footer-links a {
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.footer-links a:hover {
  border-bottom-color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 8px 25px rgba(40, 40, 40, 0.06);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.hero-img {
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: cover;
  border-radius: 16px;
}

.hero-photo-stage {
  position: relative;
  min-height: 320px;
  border-radius: 24px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(18, 30, 38, 0.08), rgba(18, 30, 38, 0.48)),
    linear-gradient(135deg, #d6efe7 0%, #f8d4af 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.hero-sign-backdrop {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.18)),
    url("https://images.unsplash.com/photo-1518391846015-55a9cc003b25?auto=format&fit=crop&w=1200&q=80");
  background-size: cover;
  background-position: center;
  transform: scale(1.04);
}

.hero-sign-backdrop::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(180deg, rgba(18, 30, 38, 0), rgba(18, 30, 38, 0.68));
}

.hero-phone {
  position: absolute;
  left: 50%;
  bottom: -28px;
  width: min(58%, 280px);
  aspect-ratio: 10 / 18.5;
  transform: translateX(-50%);
  border-radius: 34px;
  padding: 14px;
  background: linear-gradient(160deg, #0d1117 0%, #2b3139 100%);
  border: 3px solid rgba(245, 245, 245, 0.18);
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hero-phone-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 36%;
  height: 18px;
  transform: translateX(-50%);
  border-radius: 0 0 14px 14px;
  background: #05070a;
  z-index: 2;
}

.hero-phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.1)),
    url("https://images.unsplash.com/photo-1518391846015-55a9cc003b25?auto=format&fit=crop&w=900&q=80");
  background-size: cover;
  background-position: center 34%;
}

.hero-phone-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 10, 18, 0.1), rgba(4, 10, 18, 0.45)),
    linear-gradient(115deg, rgba(255, 255, 255, 0.26) 0%, rgba(255, 255, 255, 0) 38%);
}

.hero-phone-screen::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(255, 255, 255, 0.04);
}

.hero-phone-ui {
  position: absolute;
  left: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hero-phone-ui::before,
.hero-phone-ui::after {
  content: "";
  display: block;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.hero-phone-ui-top {
  top: 22px;
}

.hero-phone-ui-top::before {
  width: 56px;
  height: 6px;
}

.hero-phone-ui-top::after {
  width: 28px;
  height: 6px;
}

.hero-phone-ui-bottom {
  bottom: 18px;
  justify-content: center;
}

.hero-phone-ui-bottom::before {
  width: 70px;
  height: 7px;
  background: rgba(255, 255, 255, 0.82);
}

.hero-phone-ui-bottom::after {
  display: none;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.consent-row input {
  width: auto;
  margin-top: 2px;
}

.consent-row a {
  color: var(--accent);
}

.my-boards {
  margin: 0 0 16px;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.my-boards li {
  color: var(--ink);
}

.empty-list {
  color: var(--muted);
  list-style: none;
  margin-left: -18px;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  overflow: hidden;
}

.account-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden {
  display: none;
}

h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.muted {
  color: var(--muted);
  margin: 0 0 10px;
  font-size: 14px;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  background: #fffef8;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-secondary {
  background: #e6e4de;
  color: #243230;
}

.result {
  margin-top: 10px;
  font-size: 14px;
  color: var(--accent-2);
}

.result.hidden {
  display: none;
}

.admin-boards {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.admin-board-row {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fffef8;
}

.admin-board-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.admin-board-meta {
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.admin-users,
.special-issued {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.admin-user-row,
.special-issued-row {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fffef8;
}

.admin-user-title {
  font-weight: 700;
  word-break: break-all;
}

.admin-user-meta {
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.board-actions {
  justify-content: flex-end;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(54px, 1fr));
  gap: 8px;
}

.board-map-wrap {
  margin-top: 12px;
}

.board-map-wrap h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.board-map {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fffef8;
}

.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px dashed #b8b2a6;
  border-radius: 12px;
  overflow: hidden;
  background: #f8f7f2;
  cursor: pointer;
}

.cell.empty {
  border: 1px solid #ece7db;
  background: var(--bg);
  cursor: default;
  pointer-events: none;
}

.cell-media {
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.cell-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(to top, rgba(255, 252, 244, 0.92), rgba(255, 252, 244, 0.15));
}

.btn-location {
  border: 0;
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #1e2a2a;
  background: #e9efe8;
  cursor: pointer;
}

.cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.char-fallback {
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
  color: #41504f;
}

.nick {
  position: absolute;
  right: 6px;
  bottom: 6px;
  font-size: 11px;
  padding: 2px 4px;
  color: white;
  background: rgba(0, 0, 0, 0.48);
  border-radius: 6px;
}

dialog {
  position: relative;
  width: min(640px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.btn-icon-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(230, 228, 222, 0.92);
  color: #243230;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.btn-icon-close:hover {
  background: #ddd7ca;
}

.camera-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 12px;
  background: #111;
  margin-bottom: 10px;
}

#camera {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.capture-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}

.overlay-char {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: clamp(240px, 46vw, 340px);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
  z-index: 3;
  pointer-events: none;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.existing-photos {
  margin-bottom: 12px;
}

.existing-photos h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.existing-photos-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.existing-photo-item {
  display: grid;
  gap: 4px;
}

.existing-photo-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.existing-photo-item span {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toggle-btn {
  min-width: 68px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  background: #e6e4de;
  color: #243230;
}

.toggle-btn.on {
  background: #0f766e;
  color: #fff;
  border-color: #0f766e;
}

.location-square {
  width: min(560px, calc(100vw - 80px));
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fffef8;
  margin-bottom: 10px;
}

.location-map {
  width: 100%;
  height: 100%;
}

.location-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  padding: 14px;
}

.map-photo {
  width: 120px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin-top: 6px;
}

@media (max-width: 760px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-photo-stage {
    min-height: 280px;
  }

  .hero-phone {
    width: min(56%, 240px);
    bottom: -20px;
  }

  .grid2 {
    grid-template-columns: 1fr;
  }

  .board-grid {
    grid-template-columns: repeat(4, minmax(52px, 1fr));
  }
}
