:root {
  color-scheme: light;
  font-family: "Yu Gothic UI", "Meiryo", sans-serif;
  color: #20312d;
  background: #f4f6f2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #20312d;
  --muted: #6d7c76;
  --line: #e1e8e2;
  --green: #197a60;
  --green-dark: #12664f;
  --pale-green: #e9f4ef;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(ellipse at 12% 0%, rgba(211, 235, 221, 0.52), transparent 35rem),
    #f4f6f2;
}

button,
textarea {
  font: inherit;
}

.page-shell {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 28px;
}

.hero {
  margin-bottom: 28px;
}

.eyebrow,
.step-label {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 750;
  letter-spacing: -0.045em;
}

.hero-copy {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.97rem;
}

.release-links {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.version-badge {
  padding: 5px 9px;
  border: 1px solid #dce5de;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: #53635c;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.updates-link,
.back-link {
  color: var(--green-dark);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.updates-link:hover,
.back-link:hover {
  text-decoration: underline;
}

.updates-page .hero {
  margin-bottom: 25px;
}

.usage-page .hero {
  margin-bottom: 25px;
}

.usage-device-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.usage-card {
  padding: 21px 23px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 34px rgba(32, 49, 45, 0.045);
}

.usage-card h2 {
  margin-bottom: 14px;
  font-size: 1.15rem;
}

.usage-card .step-label {
  margin-bottom: 7px;
}

.usage-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 1.35rem;
  color: #43534c;
  font-size: 0.9rem;
  line-height: 1.7;
}

.usage-note {
  margin: 14px 0 0;
  padding: 11px 13px;
  border-radius: 8px;
  background: #fff8e6;
  color: #805b10;
  font-size: 0.82rem;
  line-height: 1.65;
}

kbd {
  padding: 2px 6px;
  border: 1px solid #d8e0da;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #f7f9f7;
  color: #354640;
  font-family: inherit;
  font-size: 0.82em;
}

.release-list {
  display: grid;
  gap: 14px;
}

.release-card {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 34px rgba(32, 49, 45, 0.045);
}

.release-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf1ed;
}

.release-heading h2 {
  margin: 0;
  font-size: 1.1rem;
}

.release-heading time {
  color: var(--muted);
  font-size: 0.8rem;
}

.release-card ul {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding-left: 1.25rem;
  color: #43534c;
  font-size: 0.9rem;
  line-height: 1.65;
}

.back-link {
  display: inline-block;
  margin-top: 22px;
}

.panel,
.filter-card,
.table-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 34px rgba(32, 49, 45, 0.045);
}

.input-panel {
  padding: 24px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.025em;
}

.section-heading .step-label {
  margin-bottom: 5px;
}

.local-badge {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--pale-green);
  color: var(--green-dark);
  font-size: 0.75rem;
  font-weight: 700;
}

textarea {
  display: block;
  width: 100%;
  min-height: 220px;
  resize: vertical;
  padding: 15px 16px;
  border: 1px solid #dce5de;
  border-radius: 10px;
  outline: none;
  background: #fbfcfb;
  color: var(--ink);
  font-family: Consolas, "Yu Gothic UI", monospace;
  font-size: 0.88rem;
  line-height: 1.65;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

textarea:focus {
  border-color: #66a992;
  box-shadow: 0 0 0 3px rgba(25, 122, 96, 0.12);
}

textarea::placeholder {
  color: #9aa8a1;
}

.input-actions,
.button-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.input-actions {
  margin-top: 16px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.button {
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 700;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:focus-visible,
.text-button:focus-visible,
.filter-options input:focus-visible {
  outline: 3px solid rgba(25, 122, 96, 0.24);
  outline-offset: 2px;
}

.button-primary {
  background: var(--green);
  color: #fff;
}

.button-primary:hover:not(:disabled) {
  background: var(--green-dark);
}

.button-secondary {
  border-color: #dce5de;
  background: #fff;
  color: #53635c;
}

.button-secondary:hover {
  background: #f6f8f6;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status-message {
  min-height: 24px;
  margin: 14px 2px 25px;
  color: var(--muted);
  font-size: 0.85rem;
}

.status-message[data-state="error"] {
  color: #a13e35;
}

.status-message[data-state="success"] {
  color: var(--green-dark);
}

.status-message[data-state="warning"] {
  padding: 10px 13px;
  border: 1px solid #efd797;
  border-radius: 8px;
  background: #fff8e6;
  color: #805b10;
  font-weight: 700;
}

.results-section[hidden] {
  display: none;
}

.results-title {
  margin-bottom: 16px;
}

.csv-button {
  flex: 0 0 auto;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  align-items: baseline;
  column-gap: 7px;
  row-gap: 4px;
  min-width: 0;
  min-height: 88px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.stat-card-accent {
  border-color: #d2e9dd;
  background: #f0f8f3;
}

.stat-label {
  grid-column: 1 / -1;
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.stat-value {
  min-width: 0;
  color: var(--ink);
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat-unit {
  color: var(--muted);
  font-size: 0.78rem;
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.75fr);
  gap: 14px;
  margin-bottom: 18px;
}

.filter-card {
  min-width: 0;
  padding: 16px;
}

.filter-card legend {
  padding: 0 5px;
  font-size: 0.96rem;
  font-weight: 750;
}

.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 2px 10px;
}

.selection-count,
.table-summary {
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.text-button {
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  cursor: pointer;
  font-size: 0.77rem;
  font-weight: 700;
}

.text-button:hover {
  text-decoration: underline;
}

.filter-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 2px 8px;
  max-height: 178px;
  overflow-y: auto;
  padding: 4px 5px;
  border-radius: 8px;
  background: #f8faf8;
}

#grade-options {
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 5px;
  border-radius: 6px;
  color: #354640;
  cursor: pointer;
  font-size: 0.81rem;
  overflow-wrap: anywhere;
}

.filter-option:hover {
  background: #edf4ef;
}

.filter-option input {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--green);
}

.table-panel {
  overflow: hidden;
}

.table-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 19px;
  border-bottom: 1px solid var(--line);
}

.table-heading h3 {
  margin: 0;
  font-size: 0.98rem;
}

.table-scroll {
  position: relative;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 0.83rem;
}

thead {
  background: #f7f9f7;
  color: #64736d;
}

th,
td {
  padding: 12px 15px;
  border-bottom: 1px solid #edf1ed;
  text-align: left;
}

th {
  font-size: 0.74rem;
  font-weight: 700;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbfdfb;
}

td {
  color: #34443e;
}

.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.numeric {
  font-weight: 650;
}

.grade-chip {
  display: inline-block;
  min-width: 30px;
  padding: 3px 7px;
  border-radius: 5px;
  background: #f0f3f1;
  color: #4d6259;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.empty-results {
  margin: 0;
  padding: 38px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
}

.page-footer {
  padding-top: 28px;
  color: #9aa59f;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 24px, 620px);
    padding-top: 32px;
  }

  .input-panel {
    padding: 18px;
  }

  textarea {
    min-height: 190px;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .usage-device-grid {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stat-card {
    min-height: 88px;
    padding: 11px 12px;
  }

  .stat-label,
  .stat-unit {
    display: initial;
  }

  .stat-label {
    min-height: 3em;
    font-size: 0.68rem;
  }

  .stat-value {
    font-size: 1.3rem;
  }

  .stat-unit {
    justify-self: end;
  }
}

@media (max-width: 480px) {
  .section-heading {
    align-items: flex-start;
  }

  .local-badge {
    font-size: 0.67rem;
  }

  .input-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .button-group {
    width: 100%;
  }

  .button-group .button {
    flex: 1;
  }

  .results-title {
    align-items: center;
  }

  .csv-button {
    padding: 0 10px;
    font-size: 0.76rem;
  }
}
