/* ===== Design tokens ===== */
:root {
  --bg: #0f172a;
  --bg-soft: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-soft: #475569;
  --text-mute: #94a3b8;
  --primary: #0f766e;
  --primary-soft: #f0fdfa;
  --primary-strong: #115e59;
  --accent: #047857;
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --shadow-sm:
    0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md:
    0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family:
    "Inter",
    "Noto Sans JP",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Hiragino Sans",
    "Meiryo",
    sans-serif;
  background:
    radial-gradient(
      circle at 0% 0%,
      rgba(13, 148, 136, 0.06) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at 100% 0%,
      rgba(16, 185, 129, 0.04) 0%,
      transparent 40%
    ),
    var(--bg-soft);
  color: var(--text);
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}
main {
  min-height: 100%;
}
a {
  color: inherit;
}
.hidden {
  display: none !important;
}

/* ===== Auth gate ===== */
.gate {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      circle at 30% 20%,
      rgba(13, 148, 136, 0.12) 0%,
      transparent 55%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(16, 185, 129, 0.1) 0%,
      transparent 55%
    ),
    var(--bg-soft);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 1rem;
}
.gate-box {
  background: var(--surface);
  padding: 2.5rem 2.5rem 2rem;
  border-radius: 16px;
  text-align: center;
  min-width: 320px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.gate-box h1 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}
.gate-box p {
  margin: 0.5rem 0 1.25rem;
  color: var(--text-soft);
  font-size: 0.9rem;
}
.gate-box input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  font-family: inherit;
}
.gate-box input:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.gate-box button {
  margin-top: 1rem;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-strong) 100%
  );
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.1s,
    box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}
.gate-box button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.4);
}
.gate-box button:active {
  transform: translateY(0);
}
.err {
  color: var(--danger);
  min-height: 1.2em;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.gate-credit {
  margin: 1.25rem 0 0;
  font-size: 0.72rem;
  color: var(--text-mute);
}
.gate-subtitle {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.06em;
}
.pw-field {
  position: relative;
}
.pw-field input {
  padding-right: 2.75rem;
}
.gate-box .pw-toggle {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  transform: translateY(-50%);
  width: auto;
  margin: 0;
  padding: 0.3rem;
  background: transparent;
  box-shadow: none;
  border: 0;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--text-mute);
}
.gate-box .pw-toggle:hover,
.gate-box .pw-toggle:active {
  transform: translateY(-50%);
  background: transparent;
  box-shadow: none;
}
.gate-box input:-webkit-autofill,
.gate-box input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  -webkit-text-fill-color: var(--text);
}
.app-footer {
  text-align: center;
  padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
  font-size: 0.78rem;
  color: var(--text-mute);
}

/* ===== Header ===== */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: calc(1rem + env(safe-area-inset-top)) 1.5rem 0;
}
header h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: nowrap;
}
.meta {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-top: 0.4rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
.meta-pill {
  padding: 0.2rem 0.6rem;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  color: var(--text-soft);
}
.logout {
  min-height: 2.4rem;
  padding: 0.45rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-soft);
  transition: all 0.15s;
}
.logout:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.75rem;
  border-bottom: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.tab {
  position: relative;
  padding: 0.6rem 1.1rem;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  font-family: inherit;
  min-height: 2.5rem;
  white-space: nowrap;
  transition: color 0.15s;
}
.tab::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: -1px;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s;
}
.tab:hover {
  color: var(--primary);
}
.tab.active {
  color: var(--primary);
  font-weight: 600;
}
.tab.active::after {
  transform: scaleX(1);
}

/* ===== Filters ===== */
.filters {
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 1100px;
  margin: 0 auto;
}
.filter-toggle {
  display: none;
}
.fp-archive-toggle {
  align-self: flex-start;
  margin-top: 0.6rem;
  padding: 0.45rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
}
.fp-archive-toggle.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-strong);
}
.firstplace-panel,
.mine-panel {
  max-width: 1100px;
  margin: 1rem auto 0;
  padding: 0.95rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.firstplace-panel h2,
.mine-panel h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}
.firstplace-panel p,
.mine-panel p {
  margin: 0.25rem 0 0;
  color: var(--text-soft);
  font-size: 0.85rem;
  line-height: 1.45;
}
.fp-subnav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.65rem;
}
.fp-mode-banner {
  margin-top: 0.65rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.45;
}
.fp-mode-banner.warn {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}
.fp-mode-banner.ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #047857;
}
.fp-request-shortcut {
  min-height: 2.25rem;
  margin-top: 0.55rem;
  padding: 0.4rem 0.75rem;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--primary-strong);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
}
.fp-request-shortcut:hover {
  background: var(--primary-soft);
}
.fp-subtab {
  min-height: 2.25rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
}
.fp-subtab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.fp-auth-box {
  min-width: min(100%, 320px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.fp-auth-status {
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
}
.fp-auth-status.ok {
  color: #047857;
}
.fp-auth-status.warn {
  color: #92400e;
}
.fp-auth-logout {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
}
.fp-auth-logout:hover {
  background: var(--surface-2);
  color: var(--text);
}
.fp-admin-request-panel {
  max-width: 1100px;
  margin: 1rem auto 0;
}
.fp-admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1rem;
  align-items: start;
}
.fp-admin-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.fp-admin-card h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}
.fp-admin-card p {
  margin: 0.25rem 0 0.9rem;
  color: var(--text-soft);
  font-size: 0.85rem;
  line-height: 1.45;
}
.fp-admin-card label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.7rem;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 700;
}
.fp-admin-card input,
.fp-admin-card textarea {
  width: 100%;
  min-height: 2.4rem;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
.fp-admin-card textarea {
  resize: vertical;
  line-height: 1.5;
}
.fp-admin-card input:focus,
.fp-admin-card textarea:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.fp-admin-primary,
.fp-admin-secondary,
.fp-admin-review-head button,
.fp-admin-request-actions button {
  min-height: 2.4rem;
  padding: 0.5rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
}
.fp-admin-secondary {
  width: 100%;
  margin-top: 0.5rem;
  color: var(--text-soft);
}
.fp-admin-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
}
.fp-admin-primary {
  width: 100%;
  margin-top: 0.9rem;
  border-color: transparent;
  background: var(--primary);
  color: #fff;
}
.fp-admin-primary:disabled,
.fp-admin-request-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.fp-admin-status {
  min-height: 1.2rem;
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  color: var(--text-soft);
}
.fp-admin-status.ok {
  color: #047857;
}
.fp-admin-status.warn,
.fp-admin-empty.warn {
  color: #b91c1c;
}
.fp-admin-review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}
.fp-admin-request-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.fp-admin-empty {
  padding: 0.8rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.88rem;
}
.fp-admin-request-item {
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.fp-admin-request-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}
.fp-admin-request-status {
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.fp-admin-request-status.approved {
  background: #dcfce7;
  color: #047857;
}
.fp-admin-request-status.rejected {
  background: #fee2e2;
  color: #b91c1c;
}
.fp-admin-request-item dl {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 0.35rem 0.65rem;
  margin: 0;
  font-size: 0.85rem;
}
.fp-admin-request-item dt {
  color: var(--text-soft);
  font-weight: 700;
}
.fp-admin-request-item dd {
  margin: 0;
  word-break: break-word;
}
.fp-admin-request-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.fp-admin-request-actions .danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.35);
}
.mine-switch {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.mine-mode {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  min-height: 2.25rem;
}
.mine-mode.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.filter-group > label {
  font-size: 0.78rem;
  color: var(--text-soft);
  min-width: 4.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.filter-group input[type="search"] {
  flex: 1;
  max-width: 400px;
  padding: 0.45rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  min-height: 2.4rem;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.filter-group input[type="search"]:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.chip {
  padding: 0.42rem 0.8rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-soft);
  transition: all 0.15s;
  font-family: inherit;
  min-height: 2.4rem;
}
.chip:hover {
  background: var(--surface-2);
  border-color: var(--text-mute);
  color: var(--text);
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.3);
}
.chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.filter-clear-all {
  min-height: 2.4rem;
  padding: 0.45rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.15s;
}
.filter-clear-all:hover {
  background: var(--surface-2);
  border-color: var(--text-mute);
  color: var(--text);
}
.filter-actions {
  justify-content: flex-start;
}

.tab:focus-visible,
.chip:focus-visible,
.act-btn:focus-visible,
.fp-subtab:focus-visible,
.logout:focus-visible,
.fp-open-btn:focus-visible,
.filter-toggle:focus-visible,
.filter-clear-all:focus-visible,
.gate-box button:focus-visible,
.fp-request-shortcut:focus-visible,
.fp-archive-toggle:focus-visible,
.fp-auth-logout:focus-visible,
.fp-admin-primary:focus-visible,
.fp-admin-secondary:focus-visible,
.fp-admin-review-head button:focus-visible,
.fp-admin-request-actions button:focus-visible,
.fp-actions-row button:focus-visible,
.fp-detail-admin-actions button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===== Event list ===== */
.list {
  padding: 1rem 1.5rem 3rem;
  display: grid;
  gap: 0.6rem;
  max-width: 1100px;
  margin: 0 auto;
}
.event {
  background: var(--surface);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.12s,
    box-shadow 0.12s,
    border-color 0.12s;
  position: relative;
  overflow: hidden;
}
.event::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--text-mute);
}
.event.online::before {
  background: linear-gradient(180deg, #06b6d4, #0891b2);
}
.event.offline::before {
  background: linear-gradient(180deg, #f59e0b, #d97706);
}
.event.hybrid::before {
  background: linear-gradient(180deg, #a855f7, #7c3aed);
}
.event.is-big3::before {
  background: linear-gradient(180deg, var(--accent), var(--primary));
  width: 5px;
}
.event:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--text-mute);
}
.event-date-col {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-start;
}
.event-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: block;
}
.event-thumb-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  font-size: 0.68rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}
.event.is-big3 .event-thumb {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.event-date {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.event-day {
  color: var(--text-soft);
  font-size: 0.8rem;
  margin-top: 0.1rem;
}
.event-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  text-decoration: none;
  display: block;
  word-break: break-word;
}
.event-title:hover {
  color: var(--primary);
}
.event-meta {
  font-size: 0.72rem;
  color: var(--text-soft);
  margin-top: 0.4rem;
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  align-items: center;
}
.badge {
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.b-format-online {
  background: #cffafe;
  color: #155e75;
}
.b-format-offline {
  background: #fef3c7;
  color: #92400e;
}
.b-format-hybrid {
  background: #ede9fe;
  color: #5b21b6;
}
.b-region {
  background: var(--primary-soft);
  color: var(--primary-strong);
}
.b-category {
  background: var(--surface-2);
  color: var(--text-soft);
}
.b-source-link {
  background: #dcfce7;
  color: #166534;
}
.b-source-bt {
  background: #fee2e2;
  color: #991b1b;
}
.b-big3 {
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.65rem;
  box-shadow: 0 1px 4px rgba(13, 148, 136, 0.3);
}
.organizer {
  color: var(--text-mute);
  font-size: 0.72rem;
}

/* ===== Action buttons (favorite / attend) ===== */
.event-actions {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  max-width: 10.5rem;
}
.act-btn {
  min-width: 2.25rem;
  min-height: 2.25rem;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-mute);
  transition: all 0.12s;
  padding: 0;
}
.act-btn.fp-edit,
.act-btn.fp-delete {
  width: auto;
  min-width: 3.2rem;
  padding: 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
}
.act-btn.fp-delete {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.35);
}
.act-btn:hover {
  background: var(--surface-2);
  border-color: var(--text-mute);
  color: var(--text);
}
.act-btn.active.fav {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #d97706;
}
.act-btn.active.att {
  background: #d1fae5;
  border-color: #10b981;
  color: #059669;
}

/* ===== Empty state ===== */
.empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-mute);
}
.empty-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  opacity: 0.4;
}

/* ===== Links view ===== */
.links-view {
  padding: 1.5rem;
  display: grid;
  gap: 1.25rem;
  max-width: 900px;
  margin: 0 auto;
}
.link-section {
  background: var(--surface);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.link-section h2 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}
.link-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.link-item {
  display: grid;
  gap: 0.2rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  transition: all 0.15s;
}
.link-item:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  transform: translateX(2px);
}
.link-name {
  font-weight: 600;
  font-size: 0.95rem;
}
.link-url {
  font-size: 0.72rem;
  color: var(--primary-strong);
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}
.link-desc {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-top: 0.2rem;
}

/* ===== Responsive ===== */
@media (max-width: 720px) {
  header {
    padding: calc(0.85rem + env(safe-area-inset-top)) 1rem 0;
  }
  header h1 {
    font-size: 1.1rem;
  }
  .tabs {
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    gap: 0.1rem;
    flex-wrap: wrap;
  }
  .tab {
    flex: 1 1 calc(50% - 0.2rem);
    text-align: center;
    padding: 0.5rem 0.4rem;
    font-size: 0.8rem;
  }
  .filter-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0.7rem 1rem 0;
    padding: 0.7rem 1rem;
    min-height: 2.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
  }
  .filters {
    padding: 0.85rem 1rem;
    display: none;
  }
  .filters.open {
    display: flex;
  }
  .list {
    padding: 0.85rem 1rem 3.5rem;
  }
  .links-view {
    padding: 1rem;
  }
  .event {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .event-date-col {
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
  }
  .event-thumb {
    width: 56px;
    height: 56px;
  }
  .event-actions {
    justify-content: flex-start;
    max-width: none;
  }
  .act-btn {
    min-width: 2.75rem;
    min-height: 2.75rem;
  }
  .firstplace-panel,
  .mine-panel {
    margin: 0.85rem 1rem 0;
    align-items: stretch;
    flex-direction: column;
  }
  .mine-switch {
    justify-content: flex-start;
  }
  .fp-auth-box {
    justify-content: flex-start;
    min-width: 0;
  }
  .fp-admin-request-panel {
    margin: 0.85rem 1rem 0;
  }
  .fp-admin-layout {
    grid-template-columns: 1fr;
  }
  .fp-admin-review-head,
  .fp-admin-request-top {
    align-items: stretch;
    flex-direction: column;
  }
  .fp-admin-request-item dl {
    grid-template-columns: 1fr;
  }
  .filter-group {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-group > label {
    min-width: auto;
  }
  .meta {
    font-size: 0.75rem;
  }
  .logout {
    margin-left: 0;
  }
  .header-top {
    align-items: center;
  }
  header h1 {
    font-size: 1rem;
    gap: 0.25rem;
  }
  .header-actions {
    flex-shrink: 0;
    gap: 0.4rem;
  }
}

@media (max-width: 380px) {
  header {
    padding-inline: 0.75rem;
  }
  header h1 {
    font-size: 0.9rem;
  }
  .header-actions {
    gap: 0.3rem;
  }
  .logout {
    min-height: 2.25rem;
    padding-inline: 0.55rem;
    font-size: 0.75rem;
  }
}

/* ===== Period range picker ===== */
.period-range {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.4rem;
  margin-left: 5rem;
  flex-wrap: wrap;
}
.period-range input[type="date"] {
  padding: 0.35rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface);
}
.period-range input[type="date"]:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.period-range span {
  color: var(--text-soft);
  font-size: 0.85rem;
}
.period-range-clear {
  padding: 0.3rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-soft);
  font-family: inherit;
  transition: all 0.15s;
}
.period-range-clear:hover {
  background: var(--surface-2);
  color: var(--text);
}
@media (max-width: 720px) {
  .period-range {
    margin-left: 0;
  }
}

/* ===== FirstPlace 投稿ボタン ===== */
.fp-open-btn {
  min-height: 2.4rem;
  padding: 0.45rem 0.9rem;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  box-shadow: none;
  transition: background 0.15s, border-color 0.15s;
}
.fp-open-btn:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

@media (max-width: 380px) {
  .fp-open-btn {
    min-height: 2.25rem;
    padding-inline: 0.55rem;
    font-size: 0.75rem;
  }
}

/* ===== FirstPlace バッジ ===== */
.b-source-firstplace {
  background: linear-gradient(135deg, #fce7f3, #ede9fe);
  color: #6d28d9;
}
.b-tag-firstplace {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.event.firstplace::before {
  background: linear-gradient(180deg, var(--accent), var(--primary));
}

/* ===== FirstPlace モーダル ===== */
.fp-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.fp-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}
.fp-modal-box {
  position: relative;
  background: var(--surface);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem 1.5rem 1.5rem;
  border: 1px solid var(--border);
}
.fp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.fp-modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.fp-close {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--text-soft);
  line-height: 1;
}
.fp-close:hover {
  background: var(--surface-2);
  color: var(--text);
}
.fp-help {
  margin: 0 0 0.85rem;
  color: var(--text-soft);
  font-size: 0.85rem;
  line-height: 1.5;
}
#fp-raw {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  line-height: 1.5;
}
#fp-raw:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.fp-actions-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}
.fp-actions-row button {
  padding: 0.55rem 1.1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-soft);
  transition: all 0.15s;
}
.fp-actions-row button:hover {
  background: var(--surface-2);
  color: var(--text);
}
.fp-actions-row button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.fp-actions-row button.danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.35);
}
.fp-actions-row button.danger.fp-danger-ready {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.fp-actions-row .fp-primary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-strong) 100%
  );
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}
.fp-actions-row .fp-primary:hover {
  background: linear-gradient(
    135deg,
    var(--primary-strong) 0%,
    var(--primary) 100%
  );
  color: #fff;
}
#fp-preview {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border);
}
#fp-preview h3 {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
}
.fp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.75rem;
}
.fp-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-soft);
  font-weight: 600;
}
.fp-grid-full {
  grid-column: 1 / -1;
}
.fp-grid input,
.fp-grid select {
  padding: 0.45rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
}
.fp-grid input:focus,
.fp-grid select:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.fp-warning {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--warn);
  border-radius: var(--radius-sm);
  color: #78350f;
  font-size: 0.85rem;
}
.fp-warning strong {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}
.fp-warning ul {
  margin: 0.3rem 0;
  padding-left: 1.25rem;
}
.fp-warning li {
  margin: 0.2rem 0;
}
.fp-warning em {
  color: var(--text-mute);
  font-style: normal;
  font-size: 0.78rem;
}
.fp-status {
  margin-top: 0.85rem;
  font-size: 0.85rem;
  color: var(--text-soft);
}
@media (max-width: 540px) {
  .fp-grid {
    grid-template-columns: 1fr;
  }
  .fp-modal-box {
    padding: 1rem 1.1rem 1.25rem;
  }
}

/* ===== FirstPlace 画像入力 ===== */
/* ===== FirstPlace ドラッグ&ドロップハイライト ===== */
.fp-modal-box.fp-drag-over {
  outline: 3px dashed var(--primary);
  outline-offset: -3px;
  background: var(--primary-soft);
  transition:
    outline 0.1s,
    background 0.15s;
}
.fp-modal-box.fp-drag-over::after {
  content: "🖼 ここに画像をドロップ";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(13, 148, 136, 0.12);
  color: var(--primary-strong);
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: var(--radius);
  pointer-events: none;
  z-index: 10;
}

.fp-image-row {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.fp-image-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-soft);
  transition: all 0.15s;
}
.fp-image-pick:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-strong);
}
.fp-past-image-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.9rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-soft);
  font-family: inherit;
  transition: all 0.15s;
}
.fp-past-image-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}
.fp-past-image-panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.fp-past-image-thumb {
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.fp-past-image-thumb:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.fp-past-image-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.fp-image-preview {
  position: relative;
  display: inline-block;
}
.fp-image-preview img {
  max-width: 160px;
  max-height: 120px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
  object-fit: cover;
}
.fp-image-preview button {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  box-shadow: var(--shadow-sm);
}
.fp-image-preview button:hover {
  background: var(--danger);
}

.fp-delete-confirm-box {
  max-width: 420px;
}
.fp-delete-confirm-help {
  margin: 0 0 0.6rem;
  color: var(--text-soft);
  font-size: 0.9rem;
}
.fp-delete-confirm-target {
  margin: 0 0 0.75rem;
  color: var(--text);
  overflow-wrap: anywhere;
}
.fp-delete-confirm-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.95rem;
}
.fp-delete-confirm-input:focus {
  outline: 0;
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16);
}

/* ===== FirstPlace カードのタイトルボタン ===== */
.event-title-button {
  background: transparent;
  border: 0;
  min-height: 2.4rem;
  padding: 0.25rem 0;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  display: block;
  word-break: break-word;
  width: 100%;
}
.event-title-button:hover {
  color: var(--primary);
}

/* ===== FirstPlace 詳細モーダル ===== */
.fp-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.fp-detail-box {
  position: relative;
  background: var(--surface);
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.fp-detail-box .fp-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  z-index: 2;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  width: 2.2rem;
  height: 2.2rem;
}
.fp-detail-image-link {
  display: block;
  background: var(--surface-2);
}
.fp-detail-image {
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  display: block;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.fp-detail-body {
  padding: 1.25rem 1.5rem 1.5rem;
}
.fp-detail-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.fp-detail-title {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  word-break: break-word;
}
.fp-detail-fields {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.5rem 0.85rem;
  margin: 0 0 1.2rem;
  font-size: 0.9rem;
}
.fp-detail-fields dt {
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.82rem;
  padding-top: 0.1rem;
}
.fp-detail-fields dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}
.fp-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.fp-detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.15s;
}
.fp-detail-link:hover {
  background: var(--surface-2);
  border-color: var(--text-mute);
}
.fp-detail-link.primary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-strong) 100%
  );
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}
.fp-detail-link.primary:hover {
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.45);
}
.fp-detail-admin-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
  padding-top: 0.2rem;
}
.fp-detail-admin-actions button {
  padding: 0.55rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  transition: all 0.15s;
}
.fp-detail-admin-actions button:hover {
  background: var(--surface-2);
  border-color: var(--text-mute);
}
.fp-detail-admin-actions button.danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.35);
}
.fp-detail-admin-actions button.danger:hover {
  background: #fef2f2;
  border-color: rgba(239, 68, 68, 0.6);
}
.fp-detail-admin-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.fp-detail-raw {
  margin-top: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.fp-detail-raw summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 600;
  user-select: none;
}
.fp-detail-raw[open] summary {
  margin-bottom: 0.6rem;
}
.fp-detail-raw pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}
@media (max-width: 540px) {
  .fp-detail-body {
    padding: 1rem 1.1rem 1.25rem;
  }
  .fp-detail-fields {
    grid-template-columns: 4.5rem 1fr;
    gap: 0.4rem 0.6rem;
  }
  .fp-detail-image {
    max-height: 320px;
  }
}
