@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@400;700;900&family=Noto+Sans+JP:wght@400;700&display=swap');

:root {
  --bg: #f0ece4;
  --surface: #fffdf7;
  --ink: #1e1e1e;
  --muted: #6b6560;
  --accent: #2d6e46;
  --accent-dark: #1e4f30;
  --accent-weak: color-mix(in oklab, var(--accent) 12%, var(--surface));
  --line: color-mix(in oklab, var(--ink) 10%, transparent);
  --step-0: clamp(0.9rem, 0.85rem + 0.25vw, 1.05rem);
  --step-1: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
  --step-2: clamp(1.3rem, 1.1rem + 1vw, 1.8rem);
  --step-3: clamp(1.8rem, 1.4rem + 2vw, 2.6rem);
  --space: clamp(1rem, 0.8rem + 1vw, 1.5rem);
  --radius: 18px;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 10px 30px -8px rgba(0,0,0,0.14);
}

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

body {
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.8;
  min-height: 100vh;
  padding: var(--space);
}

header {
  text-align: center;
  margin-bottom: calc(var(--space) * 1.2);
}

header h1 {
  font-family: "M PLUS Rounded 1c", "Hiragino Sans", sans-serif;
  font-size: var(--step-3);
  font-weight: 900;
  color: var(--accent-dark);
  line-height: 1.2;
}

header p {
  color: var(--muted);
  font-size: var(--step-0);
  margin-top: 0.4em;
}

.maker-layout {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  gap: calc(var(--space) * 1.2);
}

@media (min-width: 880px) {
  .maker-layout {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.form-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: calc(var(--space) * 1.1) calc(var(--space));
}

.form-row + .form-row {
  margin-top: 1.1em;
}

label {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 0.4em;
}

label .optional {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.82em;
  margin-left: 0.3em;
}

select,
input[type="text"],
textarea,
input[type="file"],
input[type="color"] {
  width: 100%;
  padding: 0.75em 1em;
  font-size: var(--step-0);
  font-family: inherit;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

input[type="color"] {
  padding: 0.3em;
  height: 48px;
  cursor: pointer;
}

.color-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8em;
}

select:focus,
input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 4.5em;
  line-height: 1.7;
}

input[type="file"] {
  padding: 0.55em 0.8em;
  font-size: 0.9rem;
}

.char-count {
  text-align: right;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2em;
}

button {
  font-family: "M PLUS Rounded 1c", "Hiragino Sans", sans-serif;
  font-size: var(--step-0);
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 0.85em 2.2em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px -4px var(--accent);
  display: block;
  width: 100%;
  margin-top: 1.2em;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-weak);
}

.preview-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--space));
}

.preview-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

#capture-card {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 9 / 16;
  background: linear-gradient(135deg, #1e4f30 0%, #2d6e46 100%);
  border-radius: 24px;
  padding: 1.5em 1.3em;
  color: #fff;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 48px -12px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
}

#capture-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 85%, rgba(255,255,255,0.07) 0%, transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(255,255,255,0.05) 0%, transparent 40%);
  pointer-events: none;
}

.stitch-line {
  position: absolute;
  top: 10px;
  left: 18px;
  right: 18px;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    rgba(255,255,255,0.35) 0px,
    rgba(255,255,255,0.35) 8px,
    transparent 8px,
    transparent 12px
  );
  pointer-events: none;
}

.card-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-logo-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.4em;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-logo-wrap svg {
  width: 40px;
  height: 40px;
}

.card-top-badge {
  display: inline-flex;
  align-self: center;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 999px;
  padding: 0.25em 0.9em;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.5em;
  backdrop-filter: blur(4px);
}

.card-team-name {
  font-family: "M PLUS Rounded 1c", sans-serif;
  font-size: var(--step-1);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.1em;
}

.card-subtitle {
  font-size: 0.78rem;
  opacity: 0.85;
  margin-bottom: 0.7em;
}

.card-image-wrap {
  width: 150px;
  height: 150px;
  margin: 0 auto 0.8em;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.85);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25), inset 0 0 0 1px rgba(255,255,255,0.3);
  overflow: hidden;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  opacity: 0.7;
  line-height: 1.4;
  padding: 1em;
}

.card-position {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 0.15em;
}

.card-player-name {
  font-family: "M PLUS Rounded 1c", sans-serif;
  font-size: var(--step-3);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 0.4em;
  overflow-wrap: break-word;
}

.card-divider {
  width: 50px;
  height: 3px;
  background: rgba(255,255,255,0.5);
  border-radius: 999px;
  margin: 0 auto 0.6em;
}

.card-reason-title,
.card-expect-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.75;
  margin-bottom: 0.15em;
}

.card-reason {
  font-size: 0.85rem;
  line-height: 1.55;
  opacity: 0.95;
  margin-bottom: 0.7em;
  overflow-wrap: break-word;
}

.card-expect-box {
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 0.6em 0.9em;
  border: 1px solid rgba(255,255,255,0.15);
  margin-bottom: 0.7em;
}

.card-expect {
  font-size: 0.8rem;
  line-height: 1.5;
  opacity: 0.95;
  overflow-wrap: break-word;
}

.card-footer {
  margin-top: auto;
  font-size: 0.7rem;
  opacity: 0.6;
  letter-spacing: 0.02em;
  padding-top: 0.4em;
}

.deco-diamond {
  position: absolute;
  bottom: -40px;
  right: -40px;
  width: 130px;
  height: 130px;
  border: 3px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  transform: rotate(45deg);
  pointer-events: none;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7em;
}

footer {
  text-align: center;
  padding: calc(var(--space) * 1.5) 0 var(--space);
  font-size: 0.8rem;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
