#topicsGrid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 222px), 1fr)); }
.compact-topic {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 15px;
}
.compact-topic h2 {
  margin: 0;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.compact-topic-counts, .compact-topic-progress {
  margin: 4px 0 0;
  font-size: 12px;
  color: #111111;
  font-variant-numeric: tabular-nums;
}
.compact-topic-progress { margin-bottom: 10px; }
.compact-topic-actions, .topic-practice-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: auto;
}
.compact-topic-actions button, .topic-practice-actions button {
  min-width: 0;
  min-height: 44px;
  padding: 6px;
  overflow-wrap: anywhere;
}
#topicPracticeDialog, #studyDetailDialog, #studyCreateDialog, #studyConditionDialog, #studyNoticesDialog { max-height: calc(100dvh - 28px); }
#topicPracticeDialog { max-width: 460px; }
.topic-practice-field {
  border: 0;
  padding: 0;
  min-width: 0;
  margin: 12px 0 14px;
}
.topic-practice-field legend { margin-bottom: 8px; font-size: 13px; font-weight: 750; }
#topicPracticeOptions { display: grid; gap: 7px; }
.topic-scope-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  color: #111111;
  font-size: 14px;
}
.topic-scope-option:has(input:checked) { border-color: var(--brand); background: var(--soft); }
.topic-scope-option:has(input:disabled) { cursor: default; color: #111111; background: var(--bg); }
.topic-scope-option input { accent-color: var(--brand); }
.topic-scope-count { color: #111111; font-size: 12px; }
.topic-practice-reset { display: block; min-height: 44px; margin: 8px 0 0 auto; color: #a13549; }
.multiple-help { margin: 0; color: #111111; font-size: 13px; }
.option.chosen { background: var(--soft); border-color: var(--brand); }
.options .multiple-submit { justify-self: start; min-height: 44px; }
.study-page-heading { align-items: center; gap: 10px; margin-bottom: 14px; }
.study-page-heading .action-btn { min-height: 44px; flex: none; }
.study-page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.study-page-actions button { min-height: 42px; }
.studies-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.studies-tabs button {
  padding: 8px 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fcfdf9;
  color: #111111;
  font-weight: 750;
  font-size: 13px;
}
.studies-tabs [aria-pressed="true"] { background: var(--soft); border-color: #d4e4d6; color: #111111; }
.study-group-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 265px), 1fr)); gap: 10px; }
.study-group-card { display: flex; flex-direction: column; padding: 15px 16px; min-width: 0; }
.study-group-title { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.study-group-title h2, .study-detail-info p, #studyDetailTitle { overflow-wrap: anywhere; min-width: 0; }
.study-group-title h2 { margin: 0; font-size: 16px; line-height: 1.35; }
.study-group-status {
  flex: none;
  padding: 2px 6px;
  border-radius: 5px;
  color: #111111;
  background: var(--soft);
  font-size: 11px;
  font-weight: 750;
}
.study-group-status[data-state="active"] { color: #111111; background: #e8f6f0; }
.study-group-status[data-state="ended"] { color: #111111; background: #edf2ee; }
.study-group-card p, .study-detail-info p { margin: 2px 0 4px; font-size: 13px; color: #111111; }
.study-group-footer, .study-pages { display: flex; align-items: center; gap: 10px; }
.study-group-footer { justify-content: space-between; margin-top: auto; padding-top: 9px; font-size: 12px; color: #111111; }
.study-group-footer button, .study-pages button { min-height: 42px; }
.study-group-list > .study-pages { grid-column: 1 / -1; }
.study-pages { justify-content: end; margin-top: 10px; }
.study-create-form { display: grid; gap: 14px; margin-top: 10px; }
.study-create-form label { display: grid; gap: 5px; align-content: start; font-size: 13px; font-weight: 750; min-width: 0; }
.study-create-form input, .study-create-form select {
  padding: 8px 9px;
  min-width: 0;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fcfdf9;
  color: var(--ink);
  font-size: 16px;
}
.study-create-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.study-create-form > button { min-height: 44px; }
.study-status, .study-feedback { color: #111111; font-size: 13px; margin: 3px 0; }
.study-feedback { color: #a13549; }
.study-feedback:empty { display: none; }
.study-detail-info .study-state { font-weight: 750; color: #111111; }
.study-detail-info button { margin-top: 6px; min-height: 44px; }
#studyDetailBody h3 { margin: 13px 0 7px; font-size: 14px; }
.study-members { list-style: none; margin: 0; padding: 0; }
.study-member { padding: 6px 0 9px; border-bottom: 1px solid var(--line); }
.study-member-actions { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 4px; }
.study-member-actions .ranking-user { min-height: 32px; font-size: 14px; }
.study-attendance-button { min-height: 32px; padding: 4px 7px; font-size: 11px; flex: none; }
.study-member-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  color: #111111;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.study-member-fine { text-align: right; }
.study-member-fine strong { color: var(--ink); }
.study-member-record { margin-top: 14px; }
.study-history-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.study-history-table th, .study-history-table td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.study-history-table th:first-child { text-align: left; font-weight: 650; }
.study-notice-list { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 8px; }
.study-notice { border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; overflow-wrap: anywhere; }
.study-notice[data-unread="true"] { border-color: #d0e1d1; background: var(--soft); }
.study-notice strong { font-size: 14px; }
.study-notice-changes { margin: 6px 0 0; font-size: 12px; }
.study-notice-changes > div { display: flex; flex-wrap: wrap; gap: 3px 8px; }
.study-notice-changes dt { color: #111111; }
.study-notice-changes dd { margin: 0; }
@media(max-width: 520px) {
  #topicsGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .compact-topic { padding: 10px; }
  .compact-topic h2 { font-size: 14px; }
  .compact-topic-actions { gap: 5px; }
  .compact-topic-actions button { font-size: 11px; }
  .compact-topic-counts, .compact-topic-progress { font-size: 11px; }
}
@media(max-width: 360px) {
  #topicsGrid { grid-template-columns: 1fr; }
  .study-create-row { grid-template-columns: 1fr; }
}

.study-create-form [hidden] { display: none; }
.study-create-form:has(#studyGoal:disabled) .study-create-row:has(#studyFine), .study-create-form:has(#editStudyGoal:disabled) .study-create-row:has(#editStudyFine) { grid-template-columns: 1fr; }
.study-target-progress { width: 100%; height: 8px; accent-color: var(--brand); margin: 7px 0; }
.study-target-note { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); }

.study-proposal { margin: 16px 0; padding: 12px; border: 1px solid var(--brand); border-radius: 10px; background: var(--soft); color: var(--ink); }
.study-proposal p, .study-consent-voters { font-size: 13px; line-height: 1.6; }
.study-consent-voters { padding-left: 20px; }
.study-proposal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.study-proposal-actions button { min-height: 42px; }

.source-explanation-content { color: var(--ink); font-size: 15px; line-height: 1.8; overflow-wrap: anywhere; font-weight: 400; }
.source-explanation-content p { margin: 8px 0; }
.source-explanation-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 14px 0; }
.source-explanation-content th, .source-explanation-content td { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; min-width: 80px; }
.source-explanation-content img, .source-explanation-content video, .source-explanation-content iframe { display: block; max-width: 100%; height: auto; margin: 10px 0; }
.source-explanation-content iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; }
.source-explanation-content audio { width: 100%; }
.source-version-note { padding: 10px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); font-size: 13px; }
.source-original-choices { margin: 14px 0; }
.source-original-choices summary { cursor: pointer; min-height: 35px; font-weight: 700; }

.lab-list .lab-group-heading { list-style: none; margin-top: 14px; margin-left: -16px; font-weight: 800; color: var(--ink); }
.lab-list .lab-group-heading:first-child { margin-top: 4px; }
