:root {
  --brand-dark: #042644;
  --brand-mid:  #06305F;
  --brand-light: #e0f0ff;
  --bg-light: #F4F7F9;
  --radius: 10px;
  --shadow: 0 6px 18px rgba(4, 38, 68, 0.18);
  --transition: .25s cubic-bezier(.4,0,.2,1);
  --font-main: 'Montserrat', Arial, sans-serif;
}
.custom-tool {
  font-family: var(--font-main);
  background: var(--bg-light);
  color: #333;
  line-height: 1.6;
  padding: 32px 28px;
  max-width: 1100px;
  margin: 40px auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
#restart-btn {
  position: absolute;
  top: 22px;
  right: 22px;
  background: #fff;
  border: 2px solid var(--brand-dark);
  color: var(--brand-dark);
  padding: 8px 14px;
  border-radius: calc(var(--radius) / 1.5);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  z-index: 1000;
  transition: var(--transition);
}
#restart-btn:hover { background: #f3f6f9; }
.custom-tool .submit-button {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-mid) 100%);
  color: #fff;
  border: none;
  padding: 14px 28px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 3px 8px rgba(4, 38, 68, .25);
  display: block;
  width: auto;
  margin-top: 20px;
}
.custom-tool .submit-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(4, 38, 68, .3);
}
.custom-tool form { transition: opacity .4s ease, transform .4s ease; }
.custom-tool .form-group { margin-bottom: 1.2rem; }
.custom-tool .form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: .45rem;
  color: var(--brand-dark);
  font-size: 1rem;
}
.custom-tool .form-group input,
.custom-tool .form-group select,
.custom-tool .form-group textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid #d3dbe4;
  border-radius: var(--radius);
  background: #fff;
  font-size: 1rem;
  transition: border var(--transition), box-shadow var(--transition);
  box-sizing: border-box;
}
.custom-tool .form-group input:focus,
.custom-tool .form-group select:focus,
.custom-tool .form-group textarea:focus {
  border-color: var(--brand-dark);
  box-shadow: 0 0 0 3px rgba(4, 38, 68, .12);
  outline: none;
}
.custom-tool .positions-3d-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: .95rem;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
}
.custom-tool .positions-3d-table thead {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand-mid) 100%);
  color: #fff;
}
.custom-tool .positions-3d-table th,
.custom-tool .positions-3d-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e5eaf1;
  text-align: left;
  vertical-align: top;
}
.custom-tool .positions-3d-table th {
  font-weight: 700;
  text-transform: uppercase;
  font-size: .9rem;
  letter-spacing: .4px;
}
.custom-tool .positions-3d-table tbody tr:nth-child(even) { background-color: #f8fafd; }
.custom-tool .positions-3d-table tbody tr:hover { background-color: #eaf0f7; }
.custom-tool .error-message,
.custom-tool .success-message {
  padding: 18px 22px;
  border-radius: var(--radius);
  margin-top: 20px;
  font-size: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  border-left: 6px solid;
}
.custom-tool .error-message {
  color: #fff;
  background: #ff4b4b;
  border-color: #d90000;
}
.custom-tool .success-message {
  color: var(--brand-dark);
  background: var(--brand-light);
  border-color: var(--brand-dark);
}
.custom-tool .success-message a {
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration: underline;
}
.fade-in  { animation: fadeIn  .45s var(--transition) forwards; }
.fade-out { animation: fadeOut .45s var(--transition) forwards; }
@keyframes fadeIn  { from {opacity:0; transform:translateY(25px);} to {opacity:1; transform:none;} }
@keyframes fadeOut { from {opacity:1; transform:none;} to {opacity:0; transform:translateY(-25px);} }
@media (max-width: 640px) {
  .custom-tool { padding: 24px 18px; }
  .positions-3d-table th, .positions-3d-table td { padding: 12px; font-size: .9rem; }
}