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

body {
  font-family: "BIZ UDPGothic", "Hiragino Sans", "Meiryo", sans-serif;
  background: linear-gradient(122.69deg, rgb(181, 224, 255) 0%, rgb(132, 204, 255) 101%);
  min-height: 100vh;
  min-width: 1200px;
  display: flex;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 90vh;
  background: #fff;
  border-bottom-right-radius: 30px;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.logo-wrap {
  padding: 41px 35px 0;
}

.logo-wrap img {
  width: 180px;
  height: auto;
  display: block;
}

.logo-wrap a:hover img {
  opacity: 0.7;
}

.sidebar-btn {
  display: block;
  margin: 40px 20px 0;
  padding: 14px;
  background: #2985D5;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  border-radius: 30px;
  transition: background 0.2s;
}
.sidebar-btn:hover { background: #8BB9E0; }

.sidebar-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #0052a5;
  line-height: 38px;
  margin: 15px 35px 0;
}

.nav {
  margin-top: 40px;
}

.nav-divider {
  display: block;
  width: 100%;
  height: 1px;
  background: #d0d0d0;
}

a.nav-item {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 20px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
  color: #3d3d3d;
  gap: 23px;
}

a.nav-item:hover {
  background: rgb(79 160 217 / 0.2);
}

.nav-icon {
  width: 27px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ===== Main ===== */
.main {
  padding: 4dvh 5% 6% 7%;
  margin-left: 240px;
  flex: 1;
}

.main-heading {
  font-size: 20px;
  font-weight: 700;
  color: #3d3d3d;
  height: 35px;
  line-height: 35px;
  margin-top: 13px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 250px);
  gap: 25px;
  margin-top: 2%;
}

/* ===== Nav active state ===== */
a.nav-item.active {
  background: rgba(0, 82, 165, 0.08);
  color: #0052a5;
}

/* ===== Tool Cards ===== */
a.tool-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.15);
  width: 250px;
  height: 250px;
  text-decoration: none;
  color: #3d3d3d;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 33px;
  transition: box-shadow 0.2s, transform 0.15s;
}

a.tool-card:hover {
  box-shadow: 6px 6px 16px rgba(0, 0, 0, 0.22);
  transform: translateY(-5px);
}

.card-icon {
  width: 85px;
  height: 94px;
  object-fit: contain;
  display: block;
}

.card-name {
  font-size: 20px;
  font-weight: 700;
  color: #3d3d3d;
  text-align: center;
  margin-top: 21px;
  line-height: normal;
}

.card-desc {
  font-size: 13px;
  font-weight: 700;
  color: #3d3d3d;
  text-align: center;
  line-height: 20px;
  margin-top: 10px;
  width: 220px;
}

/* ===== Page header (tool pages) ===== */
.page-header {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-top: 28px;
}

.back-link {
  font-size: 0.82rem;
  color: #4f7cff;
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

/* ===== Form card ===== */
.form-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  padding: 40px 48px;
  width: 90%;
  margin-top: 1%;
  /* max-width: 560px; */
}

.form-card h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-top: 8px;
}

.subtitle {
  font-size: 0.85rem;
  color: #666;
  margin-top: 2%;
}

.field {
  margin-top: 3.5%;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #333;
  margin-top: 6px;
}

.file-wrap {
  position: relative;
  margin-top: 1%;
  border: 2px dashed #c5cdd6;
  border-radius: 8px;
  padding: 20px 16px;
  cursor: pointer;
  transition: border-color 0.2s;
  background: #fafbfc;
}
.file-wrap:hover { border-color: #4f7cff; }
.file-wrap.has-file { border-color: #34c76f; border-style: solid; background: #f0fdf4; }

.file-wrap input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}

.file-label {
  font-size: 0.85rem;
  color: #888;
  pointer-events: none;
}
.file-label.selected { color: #1a7f4b; font-weight: 600; }

.hint {
  font-size: 0.75rem;
  color: #aaa;
  margin-top: 4px;
}

.text-input {
  width: 100%;
  margin-top: 1%;
  padding: 15px 12px;
  border: 1px solid #c5cdd6;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.text-input:focus { border-color: #4f7cff; }

button[type="submit"] {
  width: 100%;
  padding: 20px;
  background: #4f7cff;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  margin-top: 5%;
  transition: background 0.2s, opacity 0.2s;
}
button[type="submit"]:hover:not(:disabled) { background: #3a63e8; }
button[type="submit"]:disabled { opacity: 0.6; cursor: not-allowed; }

#status {
  margin-top: 20px;
  font-size: 0.875rem;
  min-height: 24px;
  text-align: center;
}

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid #c5cdd6;
  border-top-color: #4f7cff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.success { color: #1a7f4b; font-weight: 600; }
.error   { color: #e03e3e; }

.download-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 24px;
  background: #34c76f;
  color: #fff;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.9rem;
}

/* ===== File list ===== */
.file-list {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #555;
}
.file-list li {
  list-style: none;
  padding: 2px 0;
}
.file-list li::before { content: "📄 "; }

/* ===== Info / warning boxes ===== */
.info-box {
  background: #eef2ff;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.8rem;
  color: #3a5fc8;
  margin-top: 24px;
  line-height: 1.6;
}

.warn-box {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: #7a5f00;
  margin-top: 20px;
}

.manual-check-note {
  margin-top: 10px;
  font-size: 0.78rem;
  color: #7a5f00;
}

/* ===== Model selector ===== */
.model-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.model-option { cursor: pointer; }
.model-option input[type="radio"] { display: none; }

.model-card {
  border: 2px solid #c5cdd6;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fafbfc;
  transition: border-color 0.2s, background 0.2s;
}
.model-option input[type="radio"]:checked + .model-card {
  border-color: #4f7cff;
  background: #eef2ff;
}
.model-card:hover { border-color: #4f7cff; }

.model-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-desc {
  font-size: 0.75rem;
  color: #666;
  line-height: 1.5;
  margin-top: 4px;
}

.model-tag { font-size: 0.65rem; font-weight: 600; padding: 1px 6px; border-radius: 99px; }
.tag-eco  { background: #d1fae5; color: #065f46; }
.tag-high { background: #fef3c7; color: #92400e; }
