:root {
  --auth-ink: #17241b;
  --auth-muted: #647168;
  --auth-line: rgba(23, 36, 27, 0.14);
  --auth-paper: #f5f8f4;
  --auth-white: #fff;
  --auth-green: #2f6f3c;
  --auth-green-dark: #24592f;
  --auth-radius: 8px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { min-height: 100%; }

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

a { color: inherit; }

#main { min-height: 100vh; }

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 18px;
}

.auth-brand {
  position: fixed;
  top: 24px;
  left: 28px;
  color: var(--auth-green-dark);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.auth-panel {
  width: min(100%, 440px);
  padding: clamp(28px, 6vw, 48px);
  background: var(--auth-white);
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius);
  box-shadow: 0 16px 42px rgba(23, 36, 27, 0.08);
}

.auth-kicker {
  color: var(--auth-green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 12px 0 10px;
  font-size: clamp(1.55rem, 5vw, 2rem);
  line-height: 1.35;
  overflow-wrap: normal;
  text-wrap: balance;
  word-break: keep-all;
}

#authEntryDescription {
  margin: 0;
  color: var(--auth-muted);
  line-height: 1.75;
}

.auth-context {
  display: grid;
  gap: 4px;
  margin: 24px 0 18px;
  padding: 12px 14px;
  background: #eef5ef;
  border-left: 3px solid var(--auth-green);
}

.auth-context span { color: var(--auth-muted); font-size: 0.78rem; }
.auth-context strong { font-size: 0.92rem; }

.auth-primary,
.auth-secondary {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: var(--auth-radius);
  font-weight: 700;
  text-decoration: none;
}

.auth-primary {
  margin-top: 24px;
  color: var(--auth-white);
  background: var(--auth-green);
}

.auth-primary:hover, .auth-primary:focus-visible { background: var(--auth-green-dark); }

.auth-secondary {
  margin-top: 12px;
  border: 1px solid var(--auth-line);
  color: var(--auth-green-dark);
  background: var(--auth-white);
}

.auth-provider-note,
.auth-entry-status {
  margin: 12px 0 0;
  color: var(--auth-muted);
  font-size: 0.82rem;
  line-height: 1.65;
  text-align: center;
}

.auth-entry-status { min-height: 1.4em; }

.auth-native {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--auth-line);
}

.auth-native h2 {
  margin: 0;
  font-size: 1rem;
}

.auth-native-status {
  min-height: 1.5em;
  margin: 8px 0 14px;
  color: var(--auth-muted);
  font-size: 0.82rem;
  line-height: 1.6;
}
.auth-native-status:empty,
.auth-entry-status:empty { display: none; }

.auth-provider-grid { display: grid; gap: 10px; }

.auth-provider {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius);
  color: var(--auth-ink);
  background: var(--auth-white);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.auth-provider:hover, .auth-provider:focus-visible { border-color: var(--auth-green); background: #f1f7f2; }
.auth-provider-email { color: var(--auth-green-dark); }
.auth-provider-mark { display: inline-grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; font-size: 0.82rem; font-weight: 800; }
.auth-provider-google { color: #4285f4; background: #eef4ff; }
.auth-provider-line { color: #fff; background: #06c755; }
.auth-provider-email .auth-provider-mark { color: var(--auth-green-dark); background: #eef5ef; }

.auth-provider.is-processing,
.auth-primary.is-processing {
  color: transparent;
  cursor: wait;
  position: relative;
}

.auth-provider.is-processing > *,
.auth-primary.is-processing > * {
  visibility: hidden;
}

.auth-provider.is-processing::after,
.auth-primary.is-processing::after {
  animation: auth-button-spin .7s linear infinite;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  color: var(--auth-green-dark);
  content: "";
  height: 14px;
  left: 50%;
  margin: -7px 0 0 -7px;
  position: absolute;
  top: 50%;
  width: 14px;
}

.auth-primary.is-processing::after { color: #fff; }

@keyframes auth-button-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-provider.is-processing::after,
  .auth-primary.is-processing::after { animation: none; }
}

.auth-native-form { display: grid; gap: 8px; }
.auth-native-form label { color: var(--auth-muted); font-size: 0.8rem; font-weight: 700; }
.auth-native-form input { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--auth-line); border-radius: 6px; color: var(--auth-ink); background: var(--auth-white); font: inherit; }
.auth-native-form input:focus { outline: 2px solid rgba(47, 111, 60, 0.24); border-color: var(--auth-green); }
.auth-native-form-actions { display: grid; gap: 8px; margin-top: 8px; }
.auth-native-form-actions .auth-primary { margin-top: 0; border: 0; font: inherit; cursor: pointer; }
.auth-native-form-actions .auth-secondary { margin-top: 0; font: inherit; cursor: pointer; }
.auth-text-button { justify-self: center; border: 0; color: var(--auth-green-dark); background: transparent; font: inherit; font-size: 0.82rem; text-decoration: underline; cursor: pointer; }
.auth-native-fallback { margin-top: 14px; }

.auth-footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 28px;
  color: var(--auth-muted);
  font-size: 0.78rem;
}

@media (max-width: 560px) {
  .auth-brand { position: static; align-self: start; justify-self: start; }
  .auth-shell { display: flex; flex-direction: column; align-items: stretch; gap: 34px; }
  .auth-panel { width: 100%; padding: 28px 22px; }
}

/* Shared entry surface: a single account action for community and workspace. */
:root {
  --auth-ink: #1d2a2d;
  --auth-muted: #607176;
  --auth-line: #d7e2e0;
  --auth-paper: #f1f5f4;
  --auth-green: #0f766e;
  --auth-green-dark: #115e59;
  --auth-radius: 9px;
}

body { background: var(--auth-paper); }
.auth-brand { color: var(--auth-green-dark); font-size: 1.1rem; letter-spacing: 0; }
.auth-panel { width: min(100%, 460px); border-color: var(--auth-line); border-radius: 12px; box-shadow: 0 18px 44px rgba(25, 50, 52, .08); }
h1 { letter-spacing: 0; }
.auth-context { background: #e7f2ef; border-left-color: var(--auth-green); }
.auth-primary { background: var(--auth-green-dark); }
.auth-primary:hover, .auth-primary:focus-visible { background: #0b4f4b; }
.auth-secondary { border-color: var(--auth-line); color: var(--auth-green-dark); }
.auth-provider { border-color: var(--auth-line); border-radius: 8px; }
.auth-provider:hover, .auth-provider:focus-visible { border-color: var(--auth-green); background: #edf7f5; }
.auth-native { border-top-color: var(--auth-line); }
.auth-native-form input { border-color: #c7d7d3; border-radius: 7px; }
.auth-footer { color: var(--auth-muted); }

/* Keep authentication visually aligned with the public shell. */
.auth-shell {
  padding: 28px 18px;
}

.auth-panel {
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(25, 50, 52, .07);
}

.auth-primary,
.auth-secondary,
.auth-provider {
  min-height: 44px;
  border-radius: 6px;
  font-size: 14px;
}

.auth-provider-grid,
.auth-native-form-actions {
  gap: 8px;
}

.auth-native-form input {
  min-height: 44px;
  border-radius: 6px;
  font-size: 15px;
}

@media (max-width: 560px) {
  .auth-panel {
    padding: 26px 20px;
  }
}

@media (max-width: 560px) {
  /* Brand and footer links remain compact visually, but retain a reliable
     touch area on small phones. */
  .auth-brand,
  .auth-footer a {
    align-items: center;
    display: inline-flex;
    min-height: 40px;
  }

  .auth-footer {
    flex-wrap: wrap;
    gap: 4px 12px;
  }
}
