:root {
  --eazo-safe-area-top: max(56px, env(safe-area-inset-top, 0px));
  --eazo-safe-area-bottom: max(34px, env(safe-area-inset-bottom, 0px));
  --red: #e5484d;
  --ink: #171717;
  --muted: #6f6f6f;
  --soft: #f6f6f6;
  --line: #dedede;
  --line-strong: #cfcfcf;
  --paper: #ffffff;
  --field: #f3f3f3;
  --focus: #111111;
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-width: 0; background: var(--paper); }

body {
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.app {
  min-height: 100dvh;
  padding-top: var(--eazo-safe-area-top);
  padding-bottom: var(--eazo-safe-area-bottom);
  padding-left: clamp(16px, 5vw, 32px);
  padding-right: clamp(16px, 5vw, 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.shell {
  width: min(100%, 560px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  width: 100%;
}

.app-name {
  font-size: 13px;
  line-height: 1.2;
  color: #4a4a4a;
  letter-spacing: .01em;
  white-space: nowrap;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fafafa;
  flex-shrink: 0;
}

.lang-toggle button {
  min-width: 52px;
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #555;
  cursor: pointer;
  padding: 0 12px;
  white-space: nowrap;
}

.lang-toggle button.active {
  background: #111;
  color: #fff;
}

.panel,
.notice {
  background: var(--paper);
  border: 1px solid var(--red);
  border-radius: 16px;
  padding: clamp(18px, 5vw, 28px);
  width: 100%;
  min-width: 0;
}

.notice { border-color: var(--line-strong); }

h1 {
  font-size: clamp(25px, 7vw, 34px);
  line-height: 1.12;
  margin: 0 0 6px;
  letter-spacing: -0.035em;
  font-weight: 650;
}

h2 {
  font-size: 16px;
  line-height: 1.35;
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

p { margin: 0; }

.subtle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.step-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.333;
  min-width: 0;
}

.step-line span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.loss-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.loss-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 8px 0;
  border-top: 1px solid #eeeeee;
  font-size: 15px;
  line-height: 1.45;
  min-width: 0;
}

.loss-list li:first-child { border-top: 0; }

.loss-name { min-width: 0; overflow-wrap: anywhere; }
.loss-count { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13px; }

.confirm-area { margin-top: 14px; }

.instruction {
  color: #2d2d2d;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.reference {
  background: var(--field);
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  min-height: 48px;
  padding: 13px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  line-height: 1.45;
  color: #222;
  overflow-wrap: anywhere;
}

.reference.empty::before { content: "\00a0"; }

.word { white-space: pre; }
.char { display: inline-block; opacity: 1; transition: opacity 180ms linear; }
.char.gone { opacity: 0; }

input[type="text"] {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
  font-size: 16px;
  line-height: 1.4;
  min-width: 0;
}

input[type="text"]:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(0,0,0,.08); }
input[type="text"]:disabled { color: #8a8a8a; background: #fafafa; }

.shake { animation: shake 260ms ease-in-out; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

button,
.buttonlike {
  min-height: 44px;
  min-width: 44px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #111;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  white-space: nowrap;
}

button:disabled { cursor: not-allowed; color: #999; background: #f7f7f7; }
button.primary { border-color: #111; background: #111; color: #fff; }
button.danger { border-color: var(--red); background: var(--red); color: #fff; }
button.secondary { background: #f8f8f8; }
button.linkish {
  border: 0;
  background: transparent;
  color: #666;
  text-decoration: underline;
  padding-left: 0;
  padding-right: 0;
}

.status {
  margin-top: 9px;
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.cooling {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.slider-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 15px;
  line-height: 1.4;
}

.attempts { color: var(--muted); font-size: 13px; white-space: nowrap; }

input[type="range"] {
  width: 100%;
  min-height: 44px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  touch-action: pan-y;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: #dedede;
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #dedede;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 34px;
  height: 34px;
  margin-top: -14px;
  border-radius: 50%;
  border: 1px solid #9f9f9f;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.14);
}
input[type="range"]::-moz-range-thumb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #9f9f9f;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.14);
}
input[type="range"].spring { animation: springback 340ms ease-out; }
@keyframes springback {
  0% { transform: translateX(0); }
  35% { transform: translateX(-12px); }
  65% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

.result-title {
  text-transform: lowercase;
  font-size: clamp(28px, 8vw, 42px);
  letter-spacing: -0.04em;
  line-height: 1.08;
  margin: 0 0 16px;
  font-weight: 650;
}

.result-grid {
  display: grid;
  gap: 10px;
  margin: 12px 0 6px;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid #eeeeee;
  font-size: 14px;
  line-height: 1.45;
  min-width: 0;
}

.result-row .label { color: var(--muted); min-width: 0; }
.result-row .value { min-width: 0; overflow-wrap: anywhere; }

details {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: #333;
  white-space: nowrap;
}

.restored {
  border-color: var(--line-strong);
  text-align: left;
}

.restored .result-title { margin-bottom: 8px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 760px) {
  .app { justify-content: flex-start; }
  .shell { gap: 18px; }
  .panel, .notice { border-radius: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
