:root {
  --bg: #0e0e10;
  --panel: #18181b;
  --border: #2c2c32;
  --text: #efeff1;
  --text-dim: #adadb8;
  --accent: #9147ff;
  --live: #eb0400;
}

* {
  box-sizing: border-box;
}

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

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

header h1 {
  font-size: 20px;
  margin: 0;
  color: var(--accent);
}

#header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-dim);
}

#header-controls button,
#header-controls a {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
}

#header-controls button:hover,
#header-controls a:hover {
  border-color: var(--accent);
  color: var(--text);
}

main {
  padding: 24px;
}

.hidden {
  display: none !important;
}

#login-view {
  text-align: center;
  margin-top: 80px;
}

.login-button {
  display: inline-block;
  margin-top: 16px;
  background: var(--accent);
  color: white;
  padding: 10px 24px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
}

#status-bar {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 16px;
}

#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.thumb-wrap img.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.live-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--live);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.viewer-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 3px;
}

.duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 3px;
}

.card-body {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.card-info {
  min-width: 0;
}

.stream-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.user-name {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 2px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-name {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#empty-message,
#error-view {
  text-align: center;
  color: var(--text-dim);
  margin-top: 60px;
}
