:root {
  --bg: #faf6ef;
  --card: #ffffff;
  --text: #3a3229;
  --muted: #8a7d6b;
  --accent: #c0392b;
  --accent-dark: #a93226;
  --border: #e6ddd0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 8px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-name {
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header h1 {
  margin: 0;
  font-size: 1.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.back-btn {
  padding: 4px 10px;
  font-size: 0.9rem;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.event-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: background 0.15s;
}

.event-card:active {
  background: #f3ece1;
}

.event-card .event-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.event-card .event-meta {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.event-card .event-count {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* 会の詳細ヘッダー */
.event-header {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.event-header .title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.event-header .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.9rem;
  color: var(--muted);
}

.event-header .meta-row .meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.items-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.items-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.item-row .item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.item-row .num {
  font-size: 0.85rem;
  color: var(--muted);
  flex-shrink: 0;
}

.item-row .program {
  font-weight: 600;
  color: var(--accent);
}

.item-row .separator {
  color: var(--muted);
}

.item-row .performer {
  color: var(--text);
}

.item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--muted);
}

.icon-btn:hover {
  background: #f3ece1;
}

.btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--card);
  color: var(--text);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-danger {
  color: var(--accent);
  border-color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}

.modal-content {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}

.field-row {
  display: flex;
  gap: 12px;
}

.field-row .field {
  flex: 1;
}

.hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.hint-chip {
  border: 1px solid var(--border);
  background: #f7f1e7;
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}

.hint-chip:hover {
  background: #efe5d5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 0;
  line-height: 1.8;
}

/* ログイン画面 */
#authView {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.auth-logo {
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.auth-desc {
  margin: 0 0 18px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.7;
}

.auth-card .field {
  text-align: left;
}

.auth-error {
  color: var(--accent);
  font-size: 0.85rem;
  margin: 4px 0;
}

.auth-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.auth-actions .btn {
  flex: 1;
}

.auth-loading {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

@media (max-width: 480px) {
  .app-header h1 {
    font-size: 1rem;
  }

  .item-row {
    flex-wrap: wrap;
  }

  .item-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .field-row {
    flex-direction: column;
    gap: 0;
  }
}
