:root {
  --bg: #1a1a1a;
  --surface: #262626;
  --text: #f5f5f5;
  --muted: #999;
  --accent: #d4af37;
  --error: #d3202a;
  --radius: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

header#app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid #333;
}
header h1 { margin: 0; font-size: 18px; }
.user-area { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.user-area a { color: var(--accent); text-decoration: none; }

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

.btn {
  display: inline-block;
  padding: 12px 16px;
  border: 1px solid #444;
  background: #333;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 16px;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: #3d3d3d; }
.btn.primary { background: var(--accent); color: #1a1a1a; border-color: var(--accent); font-weight: 600; }
.btn.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 0;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
}
.provider-logo { width: 18px; height: 18px; flex: none; }
.btn.provider-google { background: #131314; color: #E3E3E3; border-color: #8E918F; }
.btn.provider-google:hover { background: #1F1F1F; }
.btn.provider-microsoft { background: #2F2F2F; color: #FFFFFF; border-color: #8C8C8C; }
.btn.provider-microsoft:hover { background: #3A3A3A; }

.login-card { max-width: 360px; margin: 60px auto; text-align: center; }

#wheel-stage { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.wheel-frame { position: relative; width: 100%; max-width: 480px; aspect-ratio: 1; }
#wheel-canvas {
  width: 100%; height: 100%;
  transform-origin: 50% 50%;
  will-change: transform;
}
#pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  color: #fff;
  text-shadow: 0 0 2px #000, 0 0 3px #000, 0 1px 1px #000;
  z-index: 1;
  pointer-events: none;
}
.wheel-actions { display: flex; gap: 12px; }

.manage-toolbar { display: flex; justify-content: space-between; margin-bottom: 16px; }
#deck-list { list-style: none; padding: 0; margin: 0; }
#deck-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
#deck-list img { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; }
#deck-list .deck-meta { flex: 1; min-width: 0; }
#deck-list .deck-meta .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#deck-list .deck-meta .sub { color: var(--muted); font-size: 13px; }
#deck-list button.delete {
  background: transparent;
  color: var(--error);
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
}

dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid #444;
  border-radius: var(--radius);
  padding: 20px;
  max-width: 360px;
  width: calc(100% - 32px);
  margin: auto;
  overflow-wrap: anywhere;
}
dialog * { max-width: 100%; min-width: 0; }
dialog::backdrop { background: rgba(0,0,0,0.7); }
dialog form, #result-content, .confirm-content { display: flex; flex-direction: column; gap: 12px; }
.confirm-content h2 { margin: 0; font-size: 18px; }
.confirm-content p { margin: 0; color: var(--muted); }
.btn.danger { background: var(--error); color: #fff; border-color: var(--error); font-weight: 600; }
.btn.danger:hover { background: #a3181f; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
dialog input, dialog select {
  background: #1a1a1a;
  color: var(--text);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 10px;
  font-size: 16px;
}
dialog menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; margin: 8px 0 0; }

.suggestions {
  list-style: none;
  padding: 0;
  margin: 0;
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
}
.suggestions li { padding: 8px 12px; cursor: pointer; }
.suggestions li:hover, .suggestions li.active { background: #333; }

#selected-card { display: flex; gap: 12px; align-items: center; }
#selected-art { width: 80px; border-radius: 4px; }

.color-pips { display: flex; gap: 4px; align-items: center; }
.color-pips .pip { width: 18px; height: 18px; display: block; }

#result-art { width: 100%; border-radius: var(--radius); }
.error { color: var(--error); font-size: 14px; }

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid #444;
  z-index: 100;
}
