* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

/* Color palette and base body styles are defined in the
 * "focus-lab design direction" section below. Anything you change here will
 * be overridden by that block. */

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
}

.appShell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.04;
  max-width: 760px;
}

h2 {
  font-size: 18px;
}

.workGrid,
.dataGrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.workspace,
.dataGrid > section {
  min-width: 0;
  padding: 18px;
  border: 2px solid var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sectionHeader {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.sectionHeader p {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.sectionHeader.compact {
  margin-bottom: 10px;
}

textarea {
  display: block;
  width: 100%;
  resize: vertical;
  border: 2px solid var(--ink);
  background: #fffdf9;
  color: var(--ink);
  padding: 14px;
  font: inherit;
  line-height: 1.6;
}

button {
  min-height: 42px;
  border: 2px solid var(--ink);
  border-radius: 0;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    color 120ms ease;
}

/* Primary button only: avoid affecting .danger / .secondary via cascade. */
button:not(.secondary):not(.danger):hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  transform: translateY(-1px);
}

button:not(.secondary):not(.danger):active:not(:disabled) {
  transform: translateY(0);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.18);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.secondary {
  background: #ffffff;
  color: var(--ink);
}

button.secondary:hover:not(:disabled) {
  /* Use the accent line so the hover stands out on cream / panel backgrounds
   * instead of blending in like the previous var(--soft) value did. */
  background: #e6f0df;
  border-color: var(--accent);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

button.secondary:active:not(:disabled) {
  background: #d4e4cb;
  transform: translateY(0);
}

/* Keyboard focus ring — visible on every button, including secondary/danger. */
button:focus-visible {
  outline: 3px solid rgba(46, 111, 78, 0.45);
  outline-offset: 2px;
}

button.secondary:focus-visible {
  outline-color: rgba(46, 111, 78, 0.55);
}

button.danger:focus-visible {
  outline-color: rgba(190, 91, 58, 0.55);
}

.buttonRow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.reviewGroupList {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.reviewGroupButton {
  display: grid;
  gap: 4px;
  height: auto;
  min-height: 58px;
  padding: 10px 12px;
  text-align: left;
}

.reviewGroupButton.active {
  background: var(--accent);
  border-color: var(--accent-strong);
  color: #ffffff;
}

/* Preserve the selected look on hover instead of falling back to the
 * unselected secondary hover style. */
.reviewGroupButton.active:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #ffffff;
}

.reviewGroupButton span {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.78;
}

.pdfImport {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 2px solid var(--ink);
  background: #f7fbf1;
}

.pdfImport label {
  font-weight: 700;
}

.groupSettings {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(140px, auto);
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 2px solid var(--ink);
  background: #fffdf9;
}

.groupSettings.compact {
  margin-bottom: 0;
}

.groupSettings label {
  font-weight: 700;
}

.groupSettings input,
.groupSettings select {
  min-width: 0;
  width: 100%;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  padding: 10px;
  font: inherit;
}

.pdfImport input {
  min-width: 0;
  font: inherit;
}

.pdfImport p {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.progressText {
  min-height: 22px;
  color: var(--muted);
}

.questionCard {
  margin-top: 12px;
  padding: 16px;
  border: 2px solid var(--ink);
  background: #f7fbf1;
}

.questionText {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
}

.answerWrap {
  margin-top: 14px;
}

.answerText {
  padding: 12px;
  border: 2px solid #c6a957;
  background: #fff3c8;
  line-height: 1.6;
}

.list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.list li {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fffdf9;
  overflow-wrap: anywhere;
}

.cardRow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.cardRow strong {
  min-width: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.cardAnswer {
  min-width: 0;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.danger {
  background: var(--warn);
  border-color: #8e3c25;
  color: #ffffff;
}

.danger:hover:not(:disabled) {
  background: #9a4527;
  border-color: #6f2b16;
  color: #ffffff;
  transform: translateY(-1px);
}

.danger:active:not(:disabled) {
  background: #7d3520;
  transform: translateY(0);
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .sectionHeader {
    align-items: flex-start;
    flex-direction: column;
  }

  .sectionHeader p {
    text-align: left;
  }

  .pdfImport {
    grid-template-columns: 1fr;
  }

  .groupSettings {
    grid-template-columns: 1fr;
  }

  .workGrid,
  .dataGrid {
    grid-template-columns: 1fr;
  }

}

.imageChoiceCreator {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border: 2px solid var(--ink);
  background: #fffdf9;
}

.creatorHeader {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.creatorHeader h3 {
  margin: 0;
  font-size: 15px;
}

.creatorHeader p {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.imageChoiceCreator input[type="text"],
.imageChoiceCreator input[type="file"] {
  min-width: 0;
  width: 100%;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  padding: 10px;
  font: inherit;
}

.choiceInputGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.imageChoicePreview,
.reviewImage,
.cardThumb {
  display: block;
  width: 100%;
  object-fit: contain;
  border: 2px solid var(--ink);
  background: #ffffff;
}

.imageChoicePreview {
  max-height: 220px;
}

.reviewImage {
  max-height: 360px;
  margin-top: 12px;
}

.choiceWrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.choiceButton {
  min-height: 50px;
  white-space: normal;
  text-align: left;
  line-height: 1.35;
}

.cardThumb {
  max-height: 140px;
  margin-top: 10px;
}

.cardGroup {
  display: grid;
  gap: 12px;
}

.cardGroupHeader,
.cardGroupActions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.cardGroupTitle {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.cardGroupTitle strong {
  overflow-wrap: anywhere;
}

.cardGroupTitle p {
  color: var(--muted);
  font-size: 13px;
}

.visibilityBadge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f1f4ec;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.visibilityBadge.public {
  background: #e4f3ea;
  color: #1d5b3b;
}

.visibilityBadge.private {
  background: #f7eadf;
  color: #8c4428;
}

.groupCardList {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.groupCardList.hidden {
  display: none;
}

.groupCardList > li {
  background: #ffffff;
}

@media (max-width: 860px) {
  .choiceInputGrid,
  .choiceWrap {
    grid-template-columns: 1fr;
  }

  .creatorHeader {
    align-items: flex-start;
    flex-direction: column;
  }

  .creatorHeader p {
    text-align: left;
  }
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

button,
input,
select,
textarea {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 680px) {
  body {
    background-size: 28px 28px;
  }

  .appShell {
    width: min(100% - 20px, 1120px);
    padding: 14px 0 28px;
  }

  h1 {
    font-size: 30px;
    line-height: 1.08;
  }

  .workspace,
  .dataGrid > section {
    padding: 12px;
    box-shadow: 0 10px 34px rgba(24, 33, 47, 0.08);
  }

  .workGrid,
  .dataGrid {
    gap: 12px;
    margin-top: 12px;
  }

  .buttonRow {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cardGroupHeader,
  .cardGroupActions {
    align-items: stretch;
    flex-direction: column;
  }

  button {
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
  }

  .pdfImport,
  .imageChoiceCreator,
  .questionCard {
    padding: 10px;
  }

  textarea {
    min-height: 180px;
    padding: 12px;
  }

  .questionText {
    font-size: 17px;
  }

  .reviewImage {
    max-height: 280px;
  }

  .imageChoicePreview {
    max-height: 180px;
  }

  .cardRow {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cardRow button {
    justify-self: stretch;
  }

  .list li {
    padding: 10px;
  }
}

@media (max-width: 420px) {
  .appShell {
    width: min(100% - 14px, 1120px);
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 16px;
  }

  .sectionHeader p,
  .creatorHeader p,
  .pdfImport p,
  .cardAnswer {
    font-size: 12px;
  }

  .imageChoiceCreator input[type="text"],
  .imageChoiceCreator input[type="file"],
  textarea {
    font-size: 16px;
  }

  .reviewImage {
    max-height: 220px;
  }
}

/* focus-lab design direction */
:root {
  --ink: #14231f;
  --muted: #6d776f;
  --paper: #f4f3ec;
  --panel: #fffdf8;
  --line: #d8ddd1;
  --accent: #2e6f4e;
  --accent-strong: #194930;
  --warn: #be5b3a;
  --soft: #edf4e9;
  --shadow: 0 24px 70px rgba(20, 35, 31, 0.12);
  --nav: #092d22;
  --nav-soft: #114333;
}

body {
  background:
    radial-gradient(circle at top left, rgba(46, 111, 78, 0.14), transparent 30%),
    linear-gradient(180deg, #fbfaf6 0%, #eeeee7 100%);
}

.appShell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 14px;
  width: min(1480px, calc(100% - 24px));
  min-height: 100vh;
  padding: 14px 0;
}

.mainPanel {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
}

.pageView {
  display: none;
}

.pageView.active {
  display: grid;
  gap: 12px;
}

.dashboardGrid,
.metricGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dashboardTile {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfaf4;
  color: var(--ink);
  text-decoration: none;
  transition:
    border-color 120ms ease,
    transform 120ms ease;
}

.dashboardTile:hover {
  border-color: var(--accent);
  background: #f1f7ee;
  box-shadow: 0 14px 28px rgba(46, 111, 78, 0.12);
  transform: translateY(-1px);
}

.dashboardTile:focus-visible {
  outline: 3px solid rgba(46, 111, 78, 0.45);
  outline-offset: 2px;
}

.dashboardTile span,
.metricTile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dashboardTile strong,
.metricTile strong {
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.createGrid,
.statsGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metricGrid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metricTile {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfaf4;
}

.metricTile strong {
  font-size: 24px;
}

.formMessage {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.sideNav {
  position: sticky;
  top: 14px;
  height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 16px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--nav), #051c16);
  color: #eef7ee;
  box-shadow: 0 26px 70px rgba(9, 45, 34, 0.28);
}

.brandMark {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brandIcon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #eff8ec;
  color: var(--nav);
  font-weight: 900;
}

.sideNav nav {
  display: grid;
  align-content: start;
  gap: 6px;
}

.sideNav a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: #dcebe0;
  text-decoration: none;
  font-size: 14px;
}

.sideNav a.active,
.sideNav a:hover {
  background: var(--nav-soft);
  color: #ffffff;
}

.sideNav a:focus-visible {
  outline: 2px solid #c8e3c4;
  outline-offset: 2px;
  background: var(--nav-soft);
  color: #ffffff;
}

.profilePill {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
  line-height: 1.5;
}

.profilePill span {
  color: #b9d5bd;
  font-size: 12px;
}

.authPanel {
  display: grid;
  gap: 10px;
}

.authPanel.authDisabled {
  opacity: 0.8;
}

.authButton {
  min-height: 36px;
  width: 100%;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  box-shadow: none;
  font-size: 12px;
}

.authButton.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.authGate {
  display: grid;
  gap: 12px;
}

.authGate.hidden {
  display: none;
}

.authGate button {
  justify-self: start;
}

h1 {
  font-size: clamp(28px, 3.4vw, 48px);
}

.workGrid {
  grid-template-columns: minmax(420px, 0.95fr) minmax(420px, 1.05fr);
}

.dataGrid {
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
}

.workspace,
.dataGrid > section {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
}

.sectionHeader {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.sectionHeader h2 {
  color: #132720;
  font-size: 17px;
}

.pdfImport,
.groupSettings,
.imageChoiceCreator,
.questionCard,
.list li {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfaf4;
}

textarea,
.groupSettings input,
.groupSettings select,
.imageChoiceCreator input[type="text"],
.imageChoiceCreator input[type="file"] {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffefa;
}

button {
  border: 1px solid #225a3e;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(46, 111, 78, 0.14);
}

button.secondary {
  border-color: var(--line);
  box-shadow: none;
}

.questionText {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.answerText {
  border: 1px solid #d7bf68;
  border-radius: 12px;
}

.choiceButton {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
  box-shadow: none;
}

.choiceButton:hover:not(:disabled) {
  background: #e0ecd6;
  border-color: var(--accent);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

.choiceButton:active:not(:disabled) {
  background: #cfdec3;
  transform: translateY(0);
}

.reviewImage,
.imageChoicePreview,
.cardThumb {
  border: 1px solid var(--line);
  border-radius: 14px;
}

/* (.danger styling is defined fully in the main button section above.) */

@media (max-width: 1100px) {
  .appShell {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 1480px);
    min-height: 0;
  }

  .sideNav {
    position: static;
    height: auto;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center;
    gap: 12px;
  }

  .sideNav nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .brandMark {
    padding: 0 12px 0 0;
    border-right: 1px solid rgba(255, 255, 255, 0.14);
    border-bottom: 0;
  }

  .profilePill {
    display: none;
  }

  .workGrid,
  .dataGrid,
  .statsGrid,
  .metricGrid {
    grid-template-columns: 1fr;
  }

  .metricGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 861px) and (max-width: 1100px) {
  .createGrid,
  .dashboardGrid,
  .statsGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .appShell {
    width: min(100% - 10px, 1480px);
    gap: 8px;
    padding: 5px 0 18px;
  }

  .sideNav {
    position: sticky;
    top: 5px;
    z-index: 5;
    grid-template-columns: 1fr;
    gap: 8px;
    border-radius: 14px;
    padding: 9px;
  }

  .sideNav nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .brandMark {
    padding: 0 0 8px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }

  .sideNav a {
    min-height: 40px;
    display: grid;
    place-items: center;
    padding: 8px 6px;
    font-size: 12px;
    text-align: center;
  }

  .dashboardGrid {
    grid-template-columns: 1fr;
  }

  .workspace,
  .dataGrid > section,
  .dashboardTile,
  .metricTile,
  .pdfImport,
  .groupSettings,
  .imageChoiceCreator,
  .questionCard {
    border-radius: 12px;
  }

  .workspace,
  .dataGrid > section {
    padding: 11px;
  }

  .sectionHeader {
    gap: 6px;
    padding-bottom: 8px;
  }

  .sectionHeader h2 {
    font-size: 16px;
  }

  .metricGrid,
  .createGrid,
  .statsGrid {
    grid-template-columns: 1fr;
  }

  .pdfImport,
  .groupSettings,
  .imageChoiceCreator,
  .questionCard {
    padding: 10px;
  }

  .cardGroupHeader,
  .cardGroupActions {
    align-items: stretch;
    flex-direction: column;
  }

  .cardGroupActions {
    gap: 8px;
  }

  .visibilityBadge {
    justify-content: center;
    width: 100%;
  }

  button {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }
}

@media (max-width: 420px) {
  .appShell {
    width: min(100% - 8px, 1480px);
  }

  .brandMark strong {
    font-size: 14px;
  }

  .brandIcon {
    width: 30px;
    height: 30px;
  }

  .sideNav a {
    min-height: 38px;
    padding: 7px 4px;
    font-size: 11px;
  }

  .list li {
    padding: 9px;
  }
}
