@font-face {
  font-family: 'Carlito';
  src: url('fonts/Carlito-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Carlito';
  src: url('fonts/Carlito-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Carlito';
  src: url('fonts/Carlito-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Carlito';
  src: url('fonts/Carlito-BoldItalic.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

:root {
  --font-stack: 'Carlito', 'Aptos', 'Segoe UI', 'Trebuchet MS', 'Gill Sans', 'Avenir Next', Avenir, Optima, Arial, Helvetica, sans-serif;
}

body {
  font-family: var(--font-stack);
  background: #f0f8fc;
  margin: 0;
  padding: 18px;
  color: #333;
}

.container {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-start;
  gap: 28px;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}

.left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 340px;
  flex: 0 0 340px;
}

.right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 428px;
  flex: 0 0 428px;
}

.title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1 {
  text-align: center;
  font-style: italic;
  color: #333;
  margin: 0;
  font-weight: 700;
  font-size: 32px;
}

.subtitle {
  font-style: italic;
  font-size: 14px;
  color: #666;
  margin-top: 4px;
  text-align: center;
  font-weight: 400;
}

.upload-img {
  width: 202px;
  height: 202px;
  border: 2px dashed #aaa;
  border-radius: 10px;
  object-fit: cover;
  background-color: white;
}

.info-box {
  background-color: white;
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

.info-box label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  gap: 10px;
  font-weight: 400;
}

.info-box label b {
  font-weight: 700;
}

.level-value {
  font-weight: 700;
}

.needle {
  margin-left: 6px;
}

.hidden-inline {
  display: none;
}

label {
  font-style: italic;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
}

input[type="text"] {
  width: 140px;
  border-radius: 4px;
  border: 1px solid #ccc;
  padding: 4px 6px;
  font-family: var(--font-stack);
  font-weight: 400;
}

input[type="file"] {
  max-width: 100%;
  font-family: var(--font-stack);
}

input[type="color"] {
  width: 52px;
  height: 34px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid #e8eef2;
}

.stat-name {
  font-weight: 700;
  font-style: italic;
  min-width: 72px;
}

.stat-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-value {
  min-width: 38px;
  text-align: center;
}

.adjust-btn,
button {
  font-family: var(--font-stack);
  font-weight: 400;
  background-color: #92dfec;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

button {
  margin-top: 0;
  padding: 8px 14px;
}

.adjust-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

button:hover,
.adjust-btn:hover {
  background-color: #6db5c0;
  color: white;
}

.controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.second-row {
  margin-top: 2px;
}

.chart-area {
  width: 428px;
  height: 428px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  padding: 16px;
  box-sizing: border-box;
}

.rates-box {
  width: 100%;
  background: #ffffff;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

.rates-title {
  font-size: 18px;
  font-weight: 700;
  font-style: italic;
  margin-bottom: 8px;
  text-align: center;
}

.rate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #e8eef2;
  font-size: 15px;
}

.rate-row:last-child {
  border-bottom: none;
}

.rate-row span:first-child {
  font-weight: 700;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.hidden {
  display: none;
}

.character-box,
.help-box {
  background: #fff;
  border-radius: 15px;
  position: relative;
  color: #000;
  box-sizing: border-box;
}

.character-box {
  width: 52vw;
  min-width: 800px;
  max-width: 980px;
  min-height: 62vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  overflow: hidden;
  padding: 20px;
}

.help-box {
  width: min(820px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: 24px 24px 20px 24px;
}

.help-box h2 {
  margin: 0 0 14px 0;
  text-align: center;
  font-style: italic;
}

.help-section p {
  margin: 0 0 12px 0;
  line-height: 1.45;
  font-size: 15px;
}

.help-stats {
  margin-top: 18px;
  border-top: 1px solid #e8eef2;
  padding-top: 14px;
}

.help-stats-title {
  font-size: 18px;
  font-weight: 700;
  font-style: italic;
  margin-bottom: 12px;
  text-align: center;
}

.individual-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
}

.individual-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border: 1px solid #e8eef2;
  border-radius: 8px;
  font-size: 14px;
}

.individual-stat-item span:first-child {
  font-weight: 700;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  background: none;
  border: none;
  cursor: pointer;
}

.image-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.overlay-img-wrap {
  position: relative;
  display: inline-block;
}

.overlay-img {
  width: 300px;
  height: 300px;
  object-fit: cover;
  border: 3px solid #493e3b;
  border-radius: 6px;
  background: #fff;
}

.img-watermark {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.05);
  user-select: none;
  pointer-events: none;
  letter-spacing: 1px;
}

.text-box {
  position: absolute;
  bottom: -65px;
  width: 86%;
  background: white;
  border: 3px solid #493e3b;
  padding: 10px;
  text-align: center;
  line-height: 1.5;
  font-weight: 400;
}

.text-box b {
  font-weight: 700;
}

.overlay-chart {
  display: flex;
  justify-content: center;
  align-items: center;
  width: clamp(235px, 33vw, 390px);
  height: clamp(235px, 33vw, 390px);
}

#downloadBtn {
  position: absolute;
  bottom: 10px;
  right: 10px;
}

@media (max-width: 980px) {
  .container {
    flex-wrap: wrap;
  }

  .left,
  .right,
  .chart-area {
    flex: unset;
    width: 100%;
    max-width: 428px;
  }

  .chart-area {
    height: 428px;
  }

  .individual-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .character-box {
    flex-direction: column;
    width: 92vw;
    min-width: unset;
    max-height: 92vh;
    min-height: unset;
    padding: 18px;
    gap: 24px;
    overflow-y: auto;
  }

  .overlay-img {
    width: 70vw;
    height: auto;
    max-height: 35vh;
  }

  .text-box {
    position: static;
    margin-top: 12px;
    width: 80%;
  }
}
