:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --radius: 14px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Hiragino Sans", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 12px) + 6px) 16px 10px 16px;
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.header-btn {
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-btn:active {
  background-color: rgba(0, 0, 0, 0.05);
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  flex: 1;
  padding: 0 8px;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 50px;
  z-index: 40;
}

.tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  min-width: 90px;
  padding: 10px 6px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 14px 16px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.15s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Selector Bar */
.selector-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.selector-bar label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-select {
  flex: 1;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

/* Progress bar */
.progress-container {
  margin-bottom: 16px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --radius: 14px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Hiragino Sans", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 12px) + 6px) 16px 10px 16px;
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.header-btn {
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-btn:active {
  background-color: rgba(0, 0, 0, 0.05);
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  flex: 1;
  padding: 0 8px;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 50px;
  z-index: 40;
}

.tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  min-width: 90px;
  padding: 10px 6px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 14px 16px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.15s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Selector Bar */
.selector-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.selector-bar label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-select {
  flex: 1;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

/* Progress bar */
.progress-container {
  margin-bottom: 16px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.score-badge {
  color: var(--primary);
  font-weight: 600;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background-color: var(--border-color);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary);
  transition: width 0.3s ease;
}

/* Question Card */
.card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.instruction-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.prompt-text {
  font-size: 19px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 18px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* Umlaut Bar */
.umlaut-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.umlaut-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.umlaut-key {
  padding: 6px 11px;
  border-radius: 8px;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.1s;
}

.umlaut-key:active {
  background-color: var(--primary);
  color: #fff;
}

/* Input Form */
.input-wrapper {
  position: relative;
  margin-bottom: 12px;
}

.text-input {
  width: 100%;
  padding: 12px 36px 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-main);
  font-size: 16px; /* 16px prevents iOS zoom */
  outline: none;
  transition: border-color 0.2s;
}

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

.clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.btn-group {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-primary {
  flex: 2;
  background-color: var(--primary);
  color: #ffffff;
}

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

.btn-outline {
  flex: 1;
  background: none;
  border: 1.5px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:active {
  background-color: rgba(0, 0, 0, 0.05);
}

.btn-sub {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-next {
  width: 100%;
  background-color: var(--success);
  color: #ffffff;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-icon:active {
  opacity: 0.7;
}

/* Feedback Card */
.feedback-card {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-color);
  animation: fadeIn 0.2s ease-in;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}

.status-correct {
  background-color: rgba(22, 163, 74, 0.15);
  color: var(--success);
}

.status-minor {
  background-color: rgba(217, 119, 6, 0.15);
  color: var(--warning);
}

.status-incorrect {
  background-color: rgba(220, 38, 38, 0.15);
  color: var(--danger);
}

.score-num {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
}

.feedback-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

.feedback-comment {
  font-size: 14px;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --radius: 14px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Hiragino Sans", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 12px) + 6px) 16px 10px 16px;
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.header-btn {
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-btn:active {
  background-color: rgba(0, 0, 0, 0.05);
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  flex: 1;
  padding: 0 8px;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 50px;
  z-index: 40;
}

.tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  min-width: 90px;
  padding: 10px 6px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 14px 16px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.15s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Selector Bar */
.selector-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.selector-bar label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-select {
  flex: 1;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

/* Progress bar */
.progress-container {
  margin-bottom: 16px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.score-badge {
  color: var(--primary);
  font-weight: 600;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background-color: var(--border-color);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary);
  transition: width 0.3s ease;
}

/* Question Card */
.card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.instruction-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.prompt-text {
  font-size: 19px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 18px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* Umlaut Bar */
.umlaut-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.umlaut-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.umlaut-key {
  padding: 6px 11px;
  border-radius: 8px;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: background-color 0.1s;
}

.umlaut-key:active {
  background-color: var(--primary);
  color: #fff;
}

/* Input Form */
.input-wrapper {
  position: relative;
  margin-bottom: 12px;
}

.text-input {
  width: 100%;
  padding: 12px 36px 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-main);
  font-size: 16px; /* 16px prevents iOS zoom */
  outline: none;
  transition: border-color 0.2s;
}

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

.clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.btn-group {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-primary {
  flex: 2;
  background-color: var(--primary);
  color: #ffffff;
}

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

.btn-outline {
  flex: 1;
  background: none;
  border: 1.5px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:active {
  background-color: rgba(0, 0, 0, 0.05);
}

.btn-sub {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-next {
  width: 100%;
  background-color: var(--success);
  color: #ffffff;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-icon:active {
  opacity: 0.7;
}

/* Feedback Card */
.feedback-card {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-color);
  animation: fadeIn 0.2s ease-in;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}

.status-correct {
  background-color: rgba(22, 163, 74, 0.15);
  color: var(--success);
}

.status-minor {
  background-color: rgba(217, 119, 6, 0.15);
  color: var(--warning);
}

.status-incorrect {
  background-color: rgba(220, 38, 38, 0.15);
  color: var(--danger);
}

.score-num {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
}

.feedback-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

.feedback-comment {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 12px;
  background-color: var(--bg-color);
  padding: 10px 12px;
  border-radius: 8px;
}

.answer-comparison {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ans-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
}

.ans-label {
  font-size: 12px;
  color: var(--text-muted);
  width: 65px;
  flex-shrink: 0;
}

.ans-val {
  font-weight: 600;
  color: var(--text-main);
}

.de-font {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  letter-spacing: 0.01em;
}

.next-action-bar {
  margin-top: 10px;
}

.drill-footer-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

.hidden {
  display: none !important;
}

/* Grammar View Styles */
.grammar-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.point-card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.point-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.point-body {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.example-box {
  background-color: var(--bg-color);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.example-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13.5px;
}

.example-de {
  font-weight: 600;
  color: var(--text-main);
}

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

/* Grammar Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.grammar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.grammar-table th, .grammar-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
}

.grammar-table th {
  background-color: var(--bg-color);
  color: var(--text-muted);
  font-weight: 600;
}

.grammar-table tr:last-child td {
  border-bottom: none;
}

/* Answers View */
.answers-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ans-group-card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border-color);
}

.ans-group-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.ans-item-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

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

/* Vocab View */
.vocab-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.vocab-chip {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.vocab-de {
  font-weight: 600;
  color: var(--text-main);
}

.vocab-jp {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Modals & Drawers */
.drawer-overlay, .modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.modal-overlay {
  align-items: center;
  padding: 16px;
}

.drawer-content {
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  background-color: var(--card-bg);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease-out;
}

.modal-content {
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  background-color: var(--card-bg);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.drawer-header, .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
}

.drawer-body, .modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.lessons-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lesson-item {
  padding: 12px 14px;
  border-radius: 10px;
  background-color: var(--bg-color);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
}

.lesson-item.active {
  border: 1.5px solid var(--primary);
  background-color: rgba(37, 99, 235, 0.08);
  font-weight: 600;
}

.lesson-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--primary);
  color: #fff;
}

/* Scan Image View */
.scan-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.scan-image-wrapper {
  text-align: center;
  overflow: auto;
  max-height: 65vh;
  border-radius: 8px;
  background-color: #222;
}

.scan-image-wrapper img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

