:root {
  --bg: #fff;
  --text: #000;
  --muted: #000;
  --rule: #d8d4cc;
  --hover: #ebe7df;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 14px 80px;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: baseline;
  margin-bottom: 32px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
}

.topnav a {
  color: var(--text);
  text-decoration: none;
}

.topnav a:hover { text-decoration: underline; }

.topnav .en { color: var(--muted); }

.inline-form { display: inline; margin: 0; padding: 0; }

.linklike {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}

.linklike:hover { text-decoration: underline; }

h1 {
  font-size: 28px;
  font-weight: normal;
  margin: 0 0 28px;
  line-height: 1.25;
}

h1 .en {
  display: block;
  font-size: 22px;
  color: var(--muted);
  margin-top: 4px;
}

.lang { margin-bottom: 28px; }
.lang p { margin: 0 0 14px; }
.lang.en { color: var(--muted); }

h2 {
  font-size: 17px;
  font-weight: normal;
  margin: 28px 0 8px;
  letter-spacing: 0.02em;
}

h2 .en {
  color: var(--muted);
  margin-left: 6px;
}

ul {
  margin: 0 0 24px;
  padding-left: 20px;
}

ul li { margin-bottom: 4px; }
ul li .en { color: var(--muted); margin-left: 6px; }

.schedule-day { margin: 0 0 24px; }

.schedule-day h3 {
  font-size: 15px;
  font-weight: normal;
  margin: 24px 0 10px;
}

.schedule-day h3 .en { color: var(--muted); margin-left: 6px; }

.schedule-day table {
  width: 100%;
  border-collapse: collapse;
}

.schedule-day td {
  padding: 4px 0;
  vertical-align: top;
  font-size: 15px;
  line-height: 1.4;
}

.schedule-day td.schedule-time {
  width: 1%;
  padding-right: 14px;
  white-space: nowrap;
  color: var(--muted);
}

.schedule-day td .en { color: var(--muted); font-size: 14px; }

.next-up-box {
  border: 1px solid var(--text);
  border-radius: 6px;
  padding: 14px;
  margin: 0 0 24px;
  text-align: center;
}

.next-up-box[hidden] { display: none; }

.next-up-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.next-up-event {
  font-size: 16px;
  margin-bottom: 4px;
}

.next-up-event .en { color: var(--muted); font-size: 14px; margin-left: 4px; }

.next-up-countdown {
  font-size: 13px;
  color: var(--muted);
}

.illustration {
  display: block;
  max-width: 140px;
  width: 100%;
  height: auto;
  margin: 36px auto;
}

.illustration-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin: 36px auto;
}

.illustration-row .illustration {
  margin: 0;
  flex: 0 1 auto;
  max-width: 130px;
}

.dot {
  display: inline-block;
  vertical-align: middle;
  width: 12px;
  height: 12px;
  margin-right: 4px;
  margin-top: -2px;
}

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 36px 0 24px;
}

.links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.links a {
  color: var(--text);
  text-decoration: none;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  background: transparent;
  transition: background 0.12s;
}

.links a:hover,
.links a:active { background: var(--hover); }

.links a .en { color: var(--muted); font-size: 15px; }

.links a code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  background: var(--hover);
  color: var(--text);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 13px;
}

/* forms */
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.stack label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 15px;
}

.stack input,
.stack textarea,
.stack select {
  font: inherit;
  font-size: 16px; /* iOS Safari zooms in on inputs under 16px */
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  width: 100%;
}

.stack select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%),
                    linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position: right 16px top 18px, right 11px top 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.stack textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.stack input:focus,
.stack textarea:focus,
.stack select:focus {
  outline: none;
  border-color: var(--text);
}

.stack button {
  font: inherit;
  padding: 12px 16px;
  border: 1px solid var(--text);
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  align-self: flex-start;
}

.stack button:hover { background: #222; }

.stack button.danger {
  background: transparent;
  color: #b22222;
  border-color: #b22222;
}

.stack button.danger:hover { background: #fdecec; }

.stack input[type="color"] {
  width: 60px;
  height: 40px;
  padding: 2px;
  cursor: pointer;
}

.stack .cancel {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
}

.stack .cancel:hover { text-decoration: underline; }

.error {
  color: #b22222;
  border: 1px solid #b22222;
  border-radius: 4px;
  padding: 10px 12px;
  background: #fdecec;
}

.muted-note {
  font-size: 14px;
  color: var(--muted);
  margin: -8px 0 0;
}

.muted-note code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  background: var(--hover);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 13px;
}

/* chat */
.chat {
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #fff;
  padding: 14px;
  height: 55vh;
  min-height: 320px;
  overflow-y: auto;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg { font-size: 15px; line-height: 1.5; }

.chat-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
}

.chat-meta .dot { margin: 0; vertical-align: baseline; }

.chat-time {
  color: var(--muted);
  font-size: 12px;
  margin-left: 4px;
}

.chat-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 32px;
}

.chat-form textarea {
  font: inherit;
  font-size: 16px; /* iOS Safari zooms in on inputs under 16px */
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #fff;
  resize: vertical;
  min-height: 60px;
}

.chat-form textarea:focus {
  outline: none;
  border-color: var(--text);
}

.chat-form button {
  font: inherit;
  padding: 10px 14px;
  border: 1px solid var(--text);
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  align-self: flex-start;
}

.chat-form button:hover { background: #222; }

/* profile */
.bio { margin-bottom: 24px; }

.contact {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0 0 24px;
  font-size: 15px;
}

.contact dt {
  color: var(--muted);
  margin: 0;
}

.contact dt .en { font-size: 13px; margin-left: 4px; }

.contact dd { margin: 0; }

.contact dd a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--rule);
}

.contact dd code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  background: var(--hover);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 13px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.notes {
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 16px;
  font-size: 15px;
  line-height: 1.6;
}

@media (min-width: 600px) {
  main { padding: 80px 20px; }
  h1 { font-size: 32px; }
  h1 .en { font-size: 24px; }
}
