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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f5f7fa;
  color: #1a1a1a;
  line-height: 1.6;
  padding: 0 1rem;
}

header {
  text-align: center;
  padding: 2rem 0 1rem;
}

header h1 {
  font-size: 2rem;
  color: #10897d;
}

.subtitle {
  color: #666;
  font-size: 1rem;
}

main {
  max-width: 860px;
  margin: 0 auto 3rem;
}

/* Help section */
#help-section {
  background: #fff;
  border-radius: 8px;
  padding: .75rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#help-section summary {
  font-weight: 600;
  cursor: pointer;
  padding: .25rem 0;
  color: #10897d;
}

#help-section[open] summary {
  border-bottom: 1px solid #eee;
  margin-bottom: .75rem;
  padding-bottom: .5rem;
}

.help-content { font-size: .92rem; line-height: 1.55; }
.help-content p { margin-bottom: .75rem; }
.help-content h3 { margin: 1.1rem 0 .5rem; font-size: 1rem; color: #333; }
.help-content ol, .help-content ul { margin: 0 0 .75rem 1.4rem; }
.help-content li { margin-bottom: .3rem; }
.help-content code {
  background: #f0f2f5;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: .85rem;
  font-family: "Fira Code", "Consolas", monospace;
  color: #c0392b;
  word-break: break-all;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  margin-bottom: .75rem;
}
.help-table th, .help-table td {
  text-align: left;
  padding: .4rem .6rem;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}
.help-table th {
  background: #f7f9fb;
  font-weight: 600;
}
.help-table td:first-child { white-space: nowrap; }

.examples li { margin-bottom: .6rem; }
.examples code {
  display: inline-block;
  margin-top: .2rem;
  padding: .3rem .5rem;
  font-size: .8rem;
  word-break: break-all;
}

/* Input section */
#input-section {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.input-row { margin-bottom: 1rem; }
.input-row label { display: block; font-weight: 600; margin-bottom: .3rem; }

.url-row {
  display: flex;
  gap: .5rem;
}

.url-row input {
  flex: 1;
  padding: .5rem .75rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: .95rem;
}

textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-family: "Fira Code", "Consolas", monospace;
  font-size: .85rem;
  resize: vertical;
}

.separator {
  text-align: center;
  color: #999;
  margin: .75rem 0;
  font-size: .85rem;
}

.options-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-top: .5rem;
}

.render-row {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.option label { display: block; font-weight: 600; margin-bottom: .3rem; }
.checkbox-option { align-self: center; }
.checkbox-option label { display: flex; align-items: center; gap: .4rem; cursor: pointer; }
.option input[type="color"] {
  width: 40px; height: 34px;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 2px;
  cursor: pointer;
  background: none;
}
.option select {
  padding: .45rem .6rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: .95rem;
}

/* Buttons */
button, .btn {
  display: inline-block;
  padding: .5rem 1.1rem;
  font-size: .95rem;
  font-weight: 600;
  color: #fff;
  background: #10897d;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background .2s;
}

button:hover, .btn:hover { background: #0b6b62; }
button:disabled { background: #aaa; cursor: not-allowed; }

.small-btn { font-size: .8rem; padding: .35rem .75rem; margin-top: .5rem; }

/* Error */
.error {
  background: #fce4e4;
  color: #c0392b;
  padding: .75rem 1rem;
  border-radius: 5px;
  margin-top: 1rem;
}

/* PlantUML source */
#puml-section {
  background: #fff;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-top: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#puml-section summary { font-weight: 600; cursor: pointer; }

#puml-source {
  background: #f0f2f5;
  padding: .75rem;
  border-radius: 5px;
  margin-top: .5rem;
  overflow-x: auto;
  font-size: .85rem;
  white-space: pre-wrap;
}

/* Result */
#result-section {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#result-section h2 { margin-bottom: 1rem; }

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.result-header h2 { margin-bottom: 0; }

#result-container {
  text-align: center;
  overflow: auto;
  min-height: 100px;
}

#result-container img { max-width: 100%; height: auto; }
#result-container pre { text-align: left; white-space: pre-wrap; font-size: .85rem; }

.result-actions {
  display: flex;
  gap: .75rem;
}

/* Utility */
.hidden { display: none !important; }

footer {
  text-align: center;
  padding: 1.5rem 0;
  color: #999;
  font-size: .85rem;
}

footer a { color: #10897d; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 24px; height: 24px;
  border: 3px solid #ccc;
  border-top-color: #10897d;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
  margin-right: .5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
