@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700;800;900&display=swap");

:root {
  --bg: #fff7ef;
  --bg-soft: #fffaf5;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --text: #2f241f;
  --muted: #7a675d;
  --line: #ead9ca;
  --accent: #d8835f;
  --accent-strong: #b85f3e;
  --accent-soft: #ffe7d8;
  --success: #3f8f67;
  --shadow: 0 18px 50px rgba(92, 60, 38, 0.12);
  --shadow-soft: 0 10px 26px rgba(92, 60, 38, 0.08);
  --radius: 24px;
  --radius-sm: 14px;
  font-family: "Noto Sans JP", Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-kerning: normal;
  font-optical-sizing: auto;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 230, 209, 0.95), transparent 34rem),
    linear-gradient(135deg, #fff8f0 0%, #f8eadc 52%, #fffdf9 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
.survey-title,
.thanks-title,
.followup-title,
.admin-brand,
.admin-page-title,
.dashboard-month,
.button-title {
  max-inline-size: 100%;
  font-family: "Noto Sans JP", Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-kerning: normal;
  font-feature-settings: "palt" 1;
  font-variant-east-asian: proportional-width;
  letter-spacing: 0;
  line-break: strict;
  overflow-wrap: anywhere;
  text-wrap: balance;
  word-break: keep-all;
}

a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.78rem 0.9rem;
  color: var(--text);
  background: #fffdfa;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea {
  min-height: 7rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(216, 131, 95, 0.16);
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

[role="alert"] {
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  color: #8a2d25;
  background: #fff0ec;
  border: 1px solid #f3c8bd;
}

[role="status"] {
  min-height: 1.5rem;
  color: var(--muted);
  font-weight: 700;
}

.public-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: clamp(1rem, 2vw, 2rem);
}

.survey-shell,
.thanks-shell,
.followup-shell {
  width: min(92vw, 860px);
  text-align: center;
}

.survey-panel,
.thanks-panel,
.followup-panel,
.login-panel {
  border: 1px solid rgba(234, 217, 202, 0.85);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 3.2vw, 3rem);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.survey-kicker,
.admin-kicker {
  margin: 0 0 0.75rem;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
}

.survey-title,
.thanks-title,
.followup-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1.08;
}

.thanks-title {
  line-height: 1.55;
}

.survey-description,
.survey-footer,
.thanks-link {
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.2rem);
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.55rem, 1.4vw, 1rem);
  margin: clamp(1.5rem, 3vw, 2.4rem) 0 1rem;
}

.followup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.9rem, 2vw, 1.2rem);
  margin: clamp(1.5rem, 3vw, 2.4rem) 0 1rem;
}

.rating-button,
.followup-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.35rem;
  min-height: clamp(104px, 15vw, 150px);
  border-radius: 22px;
  padding: 1.2rem;
  color: #fff;
  text-align: center;
  box-shadow: 0 14px 24px rgba(92, 60, 38, 0.13);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.rating-button--image {
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

.rating-button {
  color: var(--text);
}

.rating-button:hover,
.followup-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px rgba(92, 60, 38, 0.16);
  filter: saturate(1.08);
}

.rating-button--image:hover {
  box-shadow: none;
}

.rating-button:active,
.followup-button:active {
  transform: translateY(0);
}

.rating-icon {
  display: block;
  max-width: 100%;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800;
  object-fit: contain;
}

.rating-button--image .rating-icon {
  width: clamp(72.8px, 11.2vw, 123.2px);
  height: clamp(72.8px, 11.2vw, 123.2px);
}

.rating-label,
.followup-label {
  display: block;
  font-size: clamp(1.1rem, 2.1vw, 1.55rem);
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.skip-button {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
}

.other-comment {
  display: grid;
  gap: 0.7rem;
  width: 100%;
  margin: clamp(1.5rem, 3vw, 2.4rem) auto 0;
  text-align: left;
}

.followup-reason-form,
.followup-actions {
  display: grid;
  gap: 1rem;
}

.followup-reason-form {
  width: 100%;
}

.followup-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.followup-skip-button,
.other-comment-submit {
  border-radius: 999px;
  padding: 0.82rem 1.2rem;
  font-weight: 900;
}

.followup-skip-button {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
}

.other-comment-submit {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 20px rgba(184, 95, 62, 0.2);
}

.admin-screen {
  min-height: 100vh;
  background: #f7efe7;
}

.admin-login-screen {
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-panel {
  width: min(92vw, 440px);
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  padding: 1.5rem 1rem;
  color: #fff7ef;
  background: linear-gradient(180deg, #3f2c25 0%, #5f3f34 100%);
}

.admin-brand {
  margin: 0 0 1.4rem;
  padding: 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 900;
}

.admin-nav {
  display: grid;
  gap: 0.35rem;
}

.admin-nav a,
.admin-nav button {
  display: block;
  width: 100%;
  border-radius: 12px;
  padding: 0.78rem 0.85rem;
  color: #fff7ef;
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.admin-nav a:hover,
.admin-nav button:hover {
  background: rgba(255, 247, 239, 0.14);
  text-decoration: none;
}

.admin-nav form {
  margin: 0;
}

.admin-content {
  padding: clamp(1.2rem, 2.4vw, 2.25rem);
}

.admin-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.3rem;
}

.admin-page-title {
  margin: 0;
  font-size: clamp(1.8rem, 2.5vw, 2.6rem);
  line-height: 1.15;
}

.dashboard-month-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.dashboard-month {
  margin: 0.45rem 0 0;
  color: var(--accent-strong);
  font-size: clamp(1.45rem, 2.1vw, 2.2rem);
  font-weight: 900;
  line-height: 1.15;
}

.dashboard-month-nav .dashboard-month {
  margin: 0;
}

.dashboard-month-arrow {
  display: inline-grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

.dashboard-month-arrow:hover,
.dashboard-month-arrow:focus-visible {
  border-color: var(--accent-strong);
  background: rgba(43, 108, 176, 0.08);
  outline: none;
}

.admin-card,
.admin-panel,
.button-card {
  border: 1px solid rgba(234, 217, 202, 0.88);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
}

.admin-card,
.admin-panel {
  padding: 1.2rem;
}

.kpi-grid,
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.kpi-grid {
  margin-bottom: 1.2rem;
}

.dashboard-export-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: -0.35rem 0 1.2rem;
}

.followup-reason-panel {
  margin-top: 1.2rem;
}

.kpi-grid dt {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.kpi-grid dd {
  margin: 0.2rem 0 0;
  font-size: 2rem;
  font-weight: 900;
}

.chart-card {
  min-height: 280px;
  overflow: hidden;
}

.chart-card canvas {
  display: block;
  width: 100%;
  height: 240px;
  max-width: 100%;
}

.ratio-chart-card canvas {
  height: 320px;
}

.table-scroll {
  overflow-x: auto;
}

.reason-table {
  width: 100%;
  border-collapse: collapse;
}

.reason-table th,
.reason-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
}

.reason-table th {
  color: var(--muted);
  font-size: 0.86rem;
}

.reason-table td:first-child {
  width: 11rem;
  white-space: nowrap;
}

.reason-table td:nth-child(2) {
  white-space: pre-wrap;
}

.empty-state {
  color: var(--muted);
  font-weight: 700;
}

.admin-form,
.button-form,
.upload-form,
.followup-form {
  display: grid;
  gap: 0.9rem;
}

.admin-form {
  max-width: 780px;
}

.button-list,
.option-list {
  display: grid;
  gap: 1rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.button-card {
  padding: 1rem;
}

.button-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.button-title {
  margin: 0;
  font-size: 1.25rem;
}

.button-meta {
  color: var(--muted);
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.form-row-full {
  grid-column: 1 / -1;
}

.primary-button,
.admin-form button,
.button-form button,
.upload-form button,
.followup-form button {
  border-radius: 999px;
  padding: 0.82rem 1.2rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 20px rgba(184, 95, 62, 0.2);
  font-weight: 900;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.72rem 1rem;
  background: var(--accent-soft);
}

.flash-message {
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  color: #365f46;
  background: #eef9f1;
  border: 1px solid #c7e8cf;
}

@media (max-width: 820px) {
  .followup-grid,
  .followup-actions,
  .kpi-grid,
  .chart-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .rating-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .rating-button {
    min-height: clamp(80px, 22vw, 112px);
    padding: 0.45rem 0.25rem;
  }

  .rating-label {
    font-size: clamp(0.76rem, 2.8vw, 0.95rem);
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
  }

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