/* ========================
   Base
   ======================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:          #ffffff;
  --surface:     #f5f5f5;
  --border:      #e2e2e2;
  --text:        #1a1a1a;
  --text-muted:  #8a8a8a;
  --text-light:  #b8b8b8;
  --radius:      6px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN',
               'Hiragino Sans', 'Meiryo', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ========================
   Layout
   ======================== */
.container {
  max-width: 660px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* ========================
   Header
   ======================== */
header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}

.version {
  font-size: 0.68rem;
  color: var(--text-light);
}

/* ========================
   Intro
   ======================== */
.intro {
  margin-bottom: 2.5rem;
}

.intro p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.8;
}

/* ========================
   Form
   ======================== */
.field {
  margin-bottom: 1.75rem;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}

.required {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 400;
}

textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.15s;
}

textarea:focus {
  outline: none;
  border-color: var(--text);
}

textarea::placeholder {
  color: var(--text-light);
}

.field-hint {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: #c0392b;
}

/* ========================
   Form actions
   ======================== */
.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
}

.btn-primary,
.btn-secondary {
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.12s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--text);
  color: #fff;
  flex: 1;
}

.btn-primary:hover  { background: #333; }
.btn-primary:active { background: #000; transform: translateY(1px); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.9rem 1.25rem;
}

.btn-secondary:hover  { background: var(--border); color: var(--text); }
.btn-secondary:active { transform: translateY(1px); }

/* ========================
   Output section
   ======================== */
.output-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.output-guidance {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.output-header h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.btn-copy {
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.12s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-copy:hover  { background: var(--border); color: var(--text); }
.btn-copy:active { transform: translateY(1px); }

/* ========================
   Output blocks
   ======================== */
.output-block {
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 1rem;
}

/* Main Do block — inverted, prominent */
.output-main {
  background: var(--text);
  color: #fff;
  padding: 1.75rem 1.75rem;
  margin-bottom: 1.5rem;
}

.output-main .block-label {
  color: rgba(255, 255, 255, 0.55);
}

.output-main .block-content {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.6;
  margin-top: 0.5rem;
}

.block-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 0.6rem;
}

.block-content {
  font-size: 0.95rem;
  line-height: 1.8;
}

.block-content p {
  margin-bottom: 0.4rem;
}

.block-content p:last-child {
  margin-bottom: 0;
}

/* ========================
   Footer
   ======================== */
footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-light);
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* ========================
   History section
   ======================== */
.history-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.history-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.btn-clear-history {
  padding: 0.3rem 0.7rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.12s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-clear-history:hover  { border-color: var(--text-muted); color: var(--text-muted); }
.btn-clear-history:active { transform: translateY(1px); }

.history-list {
  list-style: none;
}

.history-item {
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.history-item:hover .history-next-do {
  color: var(--text-muted);
}

.history-item:last-child {
  border-bottom: none;
}

.history-date {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-bottom: 0.2rem;
}

.history-next-do {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.5;
}

.history-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

@keyframes fieldHighlight {
  0%   { background-color: #efefef; }
  100% { background-color: var(--bg); }
}

.field-restored {
  animation: fieldHighlight 0.8s ease-out;
}

/* ========================
   Mobile
   ======================== */
@media (max-width: 480px) {
  .container {
    padding: 1.75rem 1.1rem 3rem;
  }

  h1 {
    font-size: 1.35rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .btn-secondary {
    text-align: center;
  }

  .output-main {
    padding: 1.4rem 1.25rem;
  }

  .output-main .block-content {
    font-size: 1.05rem;
  }

  .output-block {
    padding: 1.1rem 1.25rem;
  }
}
