/* RH もくもくスペース - Red Hat認定資格 学習応援 */

:root {
  --bg: #1a1d23;
  --surface: #252930;
  --surface-hover: #2d323b;
  --border: #3d4450;
  --text: #e8eaed;
  --text-muted: #9aa0a8;
  --accent: #ee0000;
  --accent-soft: rgba(238, 0, 0, 0.15);
  --success: #3fb950;
  --success-soft: rgba(63, 185, 80, 0.15);
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --font: "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}

#app {
  min-height: 100vh;
}

.text-muted {
  color: var(--text-muted);
}

.error-message {
  color: var(--accent);
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}

.screen {
  min-height: 100vh;
  padding: 2rem 1rem 3rem;
}

.screen.hidden {
  display: none;
}

/* ----- 選択画面 ----- */

.header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: 0.02em;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

.select-card {
  max-width: 420px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.select-card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1.5rem;
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}

.field select,
.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239aa0a8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.field input[type="text"],
.field input[type="password"] {
  background-image: none;
}

.field select:focus,
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  width: 100%;
  margin-top: 0.5rem;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(238, 0, 0, 0.35);
}

.btn-primary:hover {
  background: #ff1a1a;
  box-shadow: 0 4px 12px rgba(238, 0, 0, 0.4);
}

/* ----- メイン画面 ----- */

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
}

.my-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.badge {
  padding: 0.35rem 0.75rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.connection-time {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn-leave {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
}

.btn-leave:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.main-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  max-width: 1200px;
  margin: 0 auto;
}

.main {
  flex: 1;
  min-width: 0;
  max-width: 640px;
}

/* ----- Xコミュニティ 右パネル ----- */

.x-community-panel {
  flex-shrink: 0;
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 1rem;
}

/* ----- 接続者一覧 ----- */

.connections-panel {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.connections-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.connections-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
}

.connections-update-interval {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.connections-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.connection-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.connection-item:last-child {
  border-bottom: none;
}

.connection-item.is-me {
  background: var(--accent-soft);
  margin: 0 -0.5rem;
  padding: 0.75rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  margin-bottom: 0.5rem;
}

.connection-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.connection-item-badge {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.connection-item-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.connection-item-status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.connection-item.is-me .connection-item-status {
  color: var(--text);
}

.connection-item-empty {
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  list-style: none;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.my-status-edit label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.my-status-edit input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.my-status-edit input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.my-status-edit input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.x-community-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.x-community-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.x-community-cta {
  padding: 1.25rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.x-community-cta-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.btn-x-open {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.btn-x-open:hover {
  background: #2d323b;
  border-color: var(--text-muted);
}

.timer-panel {
  text-align: center;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow);
}

.main .my-status-edit {
  margin-bottom: 2rem;
}

.timer-label {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.big-timer {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.learners-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.learners-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
}

.learner-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  transition: background 0.15s;
}

.learner-item:hover {
  background: var(--surface-hover);
}

.learner-item.is-me {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.learner-item-main {
  flex: 1;
  min-width: 0;
}

.learner-code {
  font-weight: 600;
  font-size: 1rem;
  display: block;
}

.learner-status {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.learner-item.is-me .learner-status {
  color: var(--text);
}

.learner-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.learner-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.learner-cheer-count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cheer-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-cheer-small {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.15s, border-color 0.15s;
}

.btn-cheer-small:hover {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success);
}

.btn-cheer-small.has-cheered {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success);
}

.cheer-cta {
  text-align: center;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.cheer-cta p {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.btn-cheer {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  background: var(--success-soft);
  color: var(--success);
  border: 2px solid var(--success);
}

.btn-cheer:hover {
  background: var(--success);
  color: #fff;
}

.cheer-icon {
  font-size: 1.25rem;
}

/* レスポンシブ */
@media (max-width: 900px) {
  .main-layout {
    flex-direction: column;
  }

  .main {
    max-width: none;
  }

  .x-community-panel {
    width: 100%;
    position: static;
  }
}

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

  .big-timer {
    font-size: 2rem;
  }

  .main-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
