/* ===== Design Tokens ===== */
:root {
  --bg: #FFF9E6;
  --white: #FFFFFF;
  --primary: #FF8C00;
  --primary-dark: #E07800;
  --correct: #43A047;
  --wrong: #E53935;
  --text: #2C2C2C;
  --text-sub: #757575;
  --locked: #BDBDBD;
  --border: #E0E0E0;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
  --radius: 18px;
  --font: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'YuGothic', 'Meiryo', sans-serif;
}

/* ===== Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.7;
}

/* ===== App Container ===== */
#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}

/* ===== Screens ===== */
.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  padding: 16px;
}

.screen.active {
  display: flex;
}

/* ===== Loading ===== */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  font-size: 1.2rem;
  color: var(--text-sub);
}

/* ===== App Header ===== */
.app-title {
  font-size: 2rem;
  font-weight: bold;
  text-align: center;
  color: var(--primary);
  padding: 12px 0 4px;
  letter-spacing: 0.06em;
}

.app-subtitle {
  text-align: center;
  color: var(--text-sub);
  font-size: 1rem;
  margin-bottom: 6px;
}

/* ===== Progress Dots ===== */
.progress-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px 0 12px;
}

.progress-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}

.progress-dot.done {
  background: var(--correct);
}

.progress-dot.current {
  background: var(--primary);
}

/* ===== Story List ===== */
.story-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 8px;
}

.story-item {
  display: flex;
  align-items: center;
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.12s, border-color 0.2s;
  min-height: 76px;
  user-select: none;
}

.story-item:active {
  transform: scale(0.97);
}

.story-item.unlocked {
  border-color: var(--primary);
}

.story-item.locked {
  opacity: 0.48;
  cursor: not-allowed;
}

.story-item.completed {
  border-color: var(--correct);
}

.story-item-icon {
  font-size: 2rem;
  margin-right: 16px;
  flex-shrink: 0;
}

.story-item-title {
  font-size: 1.25rem;
  font-weight: bold;
  flex: 1;
}

/* ===== Screen Header ===== */
.screen-header {
  text-align: center;
  padding: 10px 0 6px;
  font-size: 1.05rem;
  color: var(--text-sub);
  font-weight: bold;
  letter-spacing: 0.04em;
}

/* ===== Card ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 22px;
  box-shadow: var(--shadow);
  flex: 1;
  overflow-y: auto;
  margin-bottom: 14px;
}

/* ===== Story Body ===== */
.story-body {
  font-size: 1.45rem;
  line-height: 2.4;
  letter-spacing: 0.04em;
}

/* ===== Question ===== */
.question-text {
  font-size: 1.3rem;
  font-weight: bold;
  margin-bottom: 22px;
  line-height: 2.4;
}

/* ===== Choices ===== */
.choices {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.choice-btn {
  width: 100%;
  min-height: 68px;
  padding: 14px 20px;
  background: var(--white);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  box-shadow: var(--shadow);
  font-family: var(--font);
  user-select: none;
  line-height: 2.2;
}

.choice-btn:active {
  transform: scale(0.97);
  border-color: var(--primary);
  background: #FFF3E0;
}

/* ===== Buttons ===== */
.btn {
  display: block;
  width: 100%;
  min-height: 66px;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 1.3rem;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s, transform 0.1s;
  font-family: var(--font);
  margin-bottom: 12px;
  user-select: none;
  line-height: 1.4;
}

.btn:last-child {
  margin-bottom: 0;
}

.btn:active {
  transform: scale(0.97);
  opacity: 0.88;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-correct {
  background: var(--correct);
  color: white;
}

/* ===== Result Screens ===== */
.result-icon {
  font-size: 5.5rem;
  text-align: center;
  margin: 16px 0 8px;
}

.result-message {
  font-size: 1.55rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 14px;
  line-height: 1.7;
}

.result-sub {
  font-size: 1.1rem;
  text-align: center;
  color: var(--text-sub);
  margin-bottom: 14px;
}

.hint-box {
  background: #FFF3E0;
  border-left: 5px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  font-size: 1.1rem;
  line-height: 2.2;
  margin-top: 8px;
  margin-bottom: 20px;
}

/* ===== Celebration Animation ===== */
@keyframes pop {
  0%   { transform: scale(0.4); opacity: 0; }
  65%  { transform: scale(1.15); }
  100% { transform: scale(1);   opacity: 1; }
}

.animate-pop {
  animation: pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ===== Scrollbar Styling ===== */
.story-list::-webkit-scrollbar,
.card::-webkit-scrollbar {
  width: 4px;
}

.story-list::-webkit-scrollbar-track,
.card::-webkit-scrollbar-track {
  background: transparent;
}

.story-list::-webkit-scrollbar-thumb,
.card::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ===== Sound Toggle Button ===== */
#sound-btn {
  position: fixed;
  top: 6px;
  right: 6px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

#sound-btn:hover,
#sound-btn:focus {
  opacity: 0.85;
  background: rgba(0, 0, 0, 0.06);
  outline: none;
}

/* ===== Hamburger Navigation ===== */
#nav-hamburger {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

#hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  margin: 6px;
  opacity: 0.45;
  transition: opacity 0.2s, background 0.2s;
}

#hamburger-btn:hover,
#hamburger-btn:focus {
  opacity: 0.75;
  background: rgba(0, 0, 0, 0.06);
  outline: none;
}

#hamburger-btn.active {
  opacity: 0.9;
}

#hamburger-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

#hamburger-btn.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

#hamburger-btn.active span:nth-child(2) {
  opacity: 0;
}

#hamburger-btn.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

#nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1001;
}

#nav-overlay.open {
  display: block;
}

#nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: #fff;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.18);
  z-index: 1002;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

#nav-drawer.open {
  transform: translateX(0);
}

.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid #e0e0e0;
  background: #f5f5f5;
}

.nav-drawer-title {
  font-size: 1rem;
  font-weight: bold;
  color: #333;
}

.nav-close-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #666;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.nav-close-btn:hover {
  background: #e0e0e0;
}

.nav-section-label {
  font-size: 0.78rem;
  font-weight: bold;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 16px 4px;
}

.nav-list {
  list-style: none;
  padding: 0 8px;
  margin: 0 0 4px;
}

.nav-link {
  display: block;
  padding: 12px 12px;
  font-size: 0.95rem;
  color: #333;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s;
}

.nav-link:hover {
  background: #f0f0f0;
  color: #1a1a1a;
}

/* ===== Grade Select Screen ===== */
.grade-select-subtitle {
  text-align: center;
  font-size: 1.45rem;
  font-weight: bold;
  color: var(--text);
  margin-bottom: 18px;
  letter-spacing: 0.04em;
}

.grade-select-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 4px;
  flex: 1;
  overflow-y: auto;
}

.grade-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 20px 20px;
  background: var(--grade-bg, #FFF3E0);
  border: 3px solid var(--grade-color, var(--primary));
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: var(--shadow);
  font-family: var(--font);
  user-select: none;
  min-height: 90px;
}

.grade-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

.grade-btn-emoji {
  font-size: 2.6rem;
  flex-shrink: 0;
  line-height: 1;
}

.grade-btn-info {
  flex: 1;
  min-width: 0;
}

.grade-btn-label {
  font-size: 1.35rem;
  font-weight: bold;
  color: var(--grade-color, var(--primary));
  line-height: 1.3;
}

.grade-btn-adventure {
  font-size: 0.9rem;
  color: var(--text-sub);
  margin: 2px 0 8px;
}

.grade-btn-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.grade-progress-bar {
  flex: 1;
  height: 8px;
  background: rgba(0,0,0,0.08);
  border-radius: 4px;
  overflow: hidden;
}

.grade-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s;
  min-width: 0;
}

.grade-progress-text {
  font-size: 0.82rem;
  color: var(--text-sub);
  white-space: nowrap;
}

.grade-btn-arrow {
  font-size: 1.8rem;
  color: var(--grade-color, var(--primary));
  flex-shrink: 0;
  font-weight: bold;
  line-height: 1;
}

/* ===== List Screen Header ===== */
.list-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 0 0;
  position: relative;
}

.app-title-small {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--primary);
  letter-spacing: 0.06em;
}

.grade-switch-btn {
  position: absolute;
  left: 0;
  background: #f0f0f0;
  border: none;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  transition: background 0.15s;
  user-select: none;
}

.grade-switch-btn:active {
  background: #e0e0e0;
}

/* ===== Total Points Badge (List Screen) ===== */
.total-points-badge {
  text-align: center;
  font-size: 1rem;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 2px;
  letter-spacing: 0.02em;
}

.total-points-value {
  font-size: 1.15rem;
}

/* ===== Points display on Correct Screen ===== */
.points-earned-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #FFF8E1;
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-top: 14px;
  font-size: 1.1rem;
  font-weight: bold;
}

.points-earned-label {
  color: var(--text-sub);
}

.points-earned-value {
  color: var(--primary);
  font-size: 1.3rem;
}

.points-total-row {
  text-align: center;
  font-size: 1rem;
  color: var(--text-sub);
  margin-top: 8px;
  font-weight: bold;
}

/* ===== Slow-down Dialog ===== */
.slow-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slow-dialog {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 28px 24px;
  max-width: 320px;
  width: 88%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  animation: pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.slow-dialog-icon {
  font-size: 3.8rem;
  margin-bottom: 10px;
  line-height: 1;
}

.slow-dialog-text {
  font-size: 1.4rem;
  font-weight: bold;
  margin-bottom: 22px;
  line-height: 1.7;
  color: var(--text);
}

.slow-dialog-btn {
  min-height: 54px;
  font-size: 1.2rem;
  margin-bottom: 0;
}

/* ===== Praise Screen ===== */
.praise-screen .result-icon {
  font-size: 6rem;
}

/* ===== Image Story Screen ===== */
.story-image-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.story-image {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  border-radius: 12px;
  display: block;
}

/* ===== Image in Question Card ===== */
.question-image {
  width: 100%;
  height: auto;
  max-height: 180px;
  object-fit: contain;
  border-radius: 12px;
  display: block;
  margin-bottom: 16px;
}

/* ===== Image Story List Badge ===== */
.story-item-type-badge {
  font-size: 0.72rem;
  font-weight: bold;
  color: var(--white);
  background: #7B1FA2;
  border-radius: 6px;
  padding: 2px 7px;
  margin-left: 8px;
  vertical-align: middle;
  flex-shrink: 0;
  align-self: center;
}

.story-item-type-badge--sort {
  background: #00897B;
}

/* ===== Ruby (Furigana) ===== */
ruby {
  ruby-align: center;
}

rt {
  font-size: 0.55em;
  line-height: 1.2;
  text-align: center;
  color: inherit;
}

/* ===== Sort Story Screen ===== */
.sort-story-body {
  font-size: 1.45rem;
  line-height: 2.4;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.sort-story-hint {
  font-size: 1.05rem;
  color: var(--text-sub);
  text-align: center;
  margin-top: 4px;
}

/* ===== Sort Question Cards ===== */
.sort-question-card {
  overflow: visible;
}

.sort-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

.sort-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s, background 0.15s;
}

.sort-card:active {
  cursor: grabbing;
}

.sort-card-handle {
  color: var(--text-sub);
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
  letter-spacing: -2px;
}

.sort-card-text {
  flex: 1;
}

.sort-card--dragging {
  opacity: 0.35;
  border-color: var(--primary);
}

.sort-card--over {
  border-color: var(--primary);
  background: #FFF3E0;
  box-shadow: 0 4px 16px rgba(255, 140, 0, 0.22);
  transform: scale(1.02);
}

.sort-card--ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.92;
  transform: scale(1.04) rotate(1.5deg);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  border-color: var(--primary) !important;
  background: var(--white);
}

/* ===== Encyclopedia (図鑑) Button — List & Grade Select ===== */
.zukan-btn {
  position: absolute;
  right: 0;
  background: #E8F5E9;
  border: none;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.88rem;
  font-weight: bold;
  color: #2E7D32;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  transition: background 0.15s;
  user-select: none;
}

.zukan-btn:active {
  background: #C8E6C9;
}

.zukan-grade-btn {
  background: #E8F5E9;
  color: #2E7D32;
  border: none;
  flex-shrink: 0;
  font-size: 1.1rem;
  margin-top: 0;
}

.zukan-grade-btn:active {
  background: #C8E6C9;
}

/* ===== Encyclopedia (図鑑) List Screen ===== */
.zukan-progress {
  text-align: center;
  padding: 6px 4px 10px;
  flex-shrink: 0;
}

.zukan-progress-text {
  font-size: 1rem;
  font-weight: bold;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.zukan-progress-bar {
  height: 10px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 5px;
  overflow: hidden;
  margin: 0 8px;
}

.zukan-progress-fill {
  height: 100%;
  border-radius: 5px;
  background: var(--correct);
  transition: width 0.5s ease;
}

.zukan-complete-badge {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--correct);
  margin-top: 6px;
}

.zukan-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 4px 2px 8px;
}

.zukan-card {
  background: var(--white);
  border-radius: 12px;
  padding: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: 3px solid transparent;
  transition: transform 0.12s, border-color 0.2s;
  cursor: default;
  user-select: none;
}

.zukan-card--unlocked {
  border-color: var(--correct);
  cursor: pointer;
}

.zukan-card--unlocked:active {
  transform: scale(0.96);
}

.zukan-card--locked {
  opacity: 0.55;
  border-color: var(--border);
}

.zukan-card-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.zukan-card-unknown {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: bold;
  color: var(--locked);
  background: #f0f0f0;
  border-radius: 8px;
}

.zukan-card-title {
  font-size: 0.7rem;
  font-weight: bold;
  text-align: center;
  color: var(--text);
  line-height: 1.3;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Encyclopedia Detail Screen ===== */
.zukan-detail-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.zukan-detail-title {
  font-size: 1.35rem;
  font-weight: bold;
  color: var(--text);
}

.zukan-detail-img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 12px;
  display: block;
}

.zukan-detail-desc {
  font-size: 1.1rem;
  line-height: 2.0;
  color: var(--text);
  text-align: left;
  width: 100%;
}

/* ===== Encyclopedia Unlock Notice (Correct Screen) ===== */
.zukan-unlocked-note {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #E8F5E9;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 4px;
  font-size: 0.95rem;
  font-weight: bold;
  color: #2E7D32;
  line-height: 1.5;
}

.zukan-unlocked-note-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* ===== "ずかんをみる" Button (Correct Screen) ===== */
.zukan-view-btn {
  background: #E8F5E9;
  color: #2E7D32;
  border: none;
  font-size: 1.1rem;
}

.zukan-view-btn:active {
  background: #C8E6C9;
}

/* ===== User Select Screen ===== */
.user-select-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 0 0;
  position: relative;
}

.user-select-subtitle {
  text-align: center;
  font-size: 1.45rem;
  font-weight: bold;
  color: var(--text);
  margin: 10px 0 14px;
  letter-spacing: 0.04em;
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
  padding: 0 4px 8px;
}

.user-card {
  display: flex;
  align-items: center;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 3px solid transparent;
  overflow: hidden;
  transition: border-color 0.2s;
}

.user-card--current {
  border-color: var(--correct);
}

.user-card-select-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  padding: 18px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  min-height: 72px;
  user-select: none;
  transition: background 0.12s;
}

.user-card-select-btn:active {
  background: #FFF3E0;
}

.user-card-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  line-height: 1;
}

.user-card-name {
  flex: 1;
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--text);
}

.user-card-points {
  font-size: 1rem;
  font-weight: bold;
  color: var(--primary);
  white-space: nowrap;
}

.user-card-edit-btn {
  padding: 0 18px;
  align-self: stretch;
  background: none;
  border: none;
  border-left: 1px solid var(--border);
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-sub);
  transition: background 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.user-card-edit-btn:active {
  background: #f0f0f0;
}

.user-add-btn {
  background: #FFF3E0;
  color: var(--primary);
  border: 3px dashed var(--primary);
  font-size: 1.15rem;
  margin-top: 4px;
}

.user-add-btn:active {
  background: #FFE0B2;
}

/* ===== User Edit Screen ===== */
.user-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.user-edit-label {
  font-size: 1rem;
  font-weight: bold;
  color: var(--text-sub);
}

.user-edit-input {
  width: 100%;
  padding: 16px 18px;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.3rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s;
  box-shadow: var(--shadow);
}

.user-edit-input:focus {
  border-color: var(--primary);
}

.user-edit-input--error {
  border-color: var(--wrong);
  animation: shake 0.3s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60%  { transform: translateX(-6px); }
  40%, 80%  { transform: translateX(6px); }
}

.btn-danger {
  background: #FFEBEE;
  color: var(--wrong);
  border: none;
  font-size: 1.1rem;
  margin-top: 4px;
}

.btn-danger:active {
  background: #FFCDD2;
}

/* ===== Delete Confirmation Dialog ===== */
.delete-dialog-btns {
  display: flex;
  gap: 12px;
}

.delete-dialog-btns .slow-dialog-btn {
  flex: 1;
  margin-bottom: 0;
}

/* ===== User Badge (grade-select / list header) ===== */
.user-badge-row {
  display: flex;
  justify-content: center;
  margin: 4px 0 2px;
}

.user-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F5F5F5;
  border: none;
  border-radius: 20px;
  padding: 5px 14px 5px 10px;
  font-size: 0.92rem;
  font-weight: bold;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
  user-select: none;
}

.user-badge-btn:active {
  background: #E0E0E0;
}

.user-badge-icon {
  font-size: 1.1rem;
}

.user-badge-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-badge-switch {
  font-size: 0.9rem;
  color: var(--text-sub);
}
