:root {
  --primary-color: #ed6d3d;
  --bg-color: #1c5e4f;
  --card-bg: #3c7c71;
  --text-color: #eeeeee;
  --radenA-color: #1c5e4f;
  --radenB-color: #3c7c71;
}

@import url('https://fonts.googleapis.com/css2?family=Zen+Kurenaido&display=swap');

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;

  user-select: none;
  -webkit-touch-callout: none; 
  -webkit-user-select: none; 
  -moz-user-select: none;
  -ms-user-select: none;
}
h1 {
  font-size: 1.5rem; 
  margin: 15px;
  text-align: center;
}
p{
  font-size : 1.1rem; 
  margin: 10px;
}
span{
  font-size: 1.1rem;
}
canvas {
  max-width: 100%;
  height: auto;
  display: block;
}
button {
    padding: 7.5px 17.5px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.2s;
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


#title{
  font-size: 1.35rem;
}

.container {
  background-color: var(--card-bg);
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  max-width: 820px;
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

.preview-container {
  width: 95%;
  display: flex;
  justify-content: center;
  background-color: #aaa; 
  border-radius: 8px;
  overflow: hidden;
  border: var(--radenA-color) solid 4px;
  border-radius: 0%;
  padding: 10px;
  margin: auto;
}

#tab-container{
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 2px dashed #ccc;
  border-radius: 8px;
  margin: 20px;
  text-align: center;
  transition: background-color 0.2s;
}
#tab-container ul{
  margin: 7.5px;
  padding: 0;
}
#tab-container ul li{
    color: white;
    padding: 8.5px 12.5px;
    margin: 0 5px;
    border-radius: 10px;
    font-weight: bold;
    display: inline-block;
    vertical-align: middle;
    user-select: none;
}
.tab-btn{
  cursor: pointer;
}
.tab-btn[aria-pressed="true"]{
    background-color: var(--primary-color);
}
.tab-btn[aria-pressed="false"]{
    background-color: #666;
}
.tool-container{
  align-items: center;
}
.tool-container[aria-hidden="true"]{
  display: none;
}
.tool-container[aria-hidden="false"]{
  display: block;
}

.frame-selector {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}
.frame-option {
    width: 100px;
    height: 100px;
    border: 3px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
    transition: border-color 0.2s;
    position: relative;
}
.frame-option img{
  height: 100%;
  object-fit: cover;
  transform: scale(3.5);
}
.frameNo-1{
  transform-origin: 113% 94%
}
.frameNo-2{
  transform-origin: 114% 94%
}    
.frameNo-3{
  transform-origin: 115.5% 94%
}
.frame-option.selected {
    border-color: var(--primary-color);
}

.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s;
  user-select: none;
  justify-content: center;
}
.upload-area:hover {
    background-color: var(--radenA-color);
}
.upload-mes{
  margin-top: 10px;
  font-size: 1rem;
}
input[type="file"] {
    display: none;
}
.upload-btn {
  background-color: var(--primary-color);
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: bold;
  display: inline-block;
  pointer-events: none;
}

#nameInput{
  width: 50%;
  margin-left: 30px;
  font-size: 1.2rem;
}
#fontSizer{
  padding: 5px 25px;
}
#fontSizer label{
  font-size : 1.1rem;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent; 
  cursor: pointer;
  width: 60%;
}
input[type="range"]::-webkit-slider-runnable-track {
  background: #ddd; 
  height: 8px; 
  border-radius: 4px; 
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -6px; 
  background-color: var(--primary-color); 
  height: 20px;
  width: 20px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 10px
}
#downloadBtn {
    background-color: var(--primary-color);
    color: white;
}
#resetBtn {
    background-color: #e0e0e0;
    color: #333;
}
.finish-explain{
  font-size: 0.9rem;
  margin-top: 15px;
}

#ImageOutput{
    max-width: 100%;
    height: auto;
    display: block;
    -webkit-touch-callout: default; 
}

input[type="range"]:active::-webkit-slider-thumb {
  background-color: #e5533d;
}

#credit{
  font-size: 1rem;
  margin: -5px 25px;
}
#credit h3{
  margin: 5% 0%;
}
#credit h4{
  margin: 5% 0%;
}
#credit span{
  font-size: 1rem;
}
a{
  color:var(--primary-color);
}

#howtoBtn{
  width: 80px;
  height: 80px;
  position: fixed;
  bottom: 1%;
  right: 2.5%;
  background-image: radial-gradient(circle, var(--primary-color) 60%, transparent 61%);
  text-align: center;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}
#howto{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh; 
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
#howto[aria-hidden="false"]{
  display: flex;
}
#howto[aria-hidden="true"]{
  display: none;
}
.howto-contents{
  background-color: rgba(255, 255, 255, 1);
  color: #444444;
  padding: 20px;
  margin: 2%;
  border-radius: 8px;
  font-size: 1rem;
  max-height: 80vh;
  overflow-y: auto;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
.howto-contents h3{
  text-align: center;
  margin: 2%;
}
.howto-contents h4{
  margin: 4% 0%;
}
.howto-contents h5{
  font-size: 1rem;
  margin: 1.5% 0%;
}
#howtoCloseBtn {
background-color: var(--primary-color);
color: white;
display: flex;
margin: auto;
}


@media ((min-width: 650px) and (max-height: 420px)){
  #title { font-size: 1.5rem; }
  .container-sideways{
    display: grid;
    grid-template-rows: 19.5% 67.5% 19.5%;
    grid-template-columns: 55% 45%;
    padding:3%;
    min-height: 80vh;
  }
  .sideways-item{
    display: grid;
    place-items: center;  
  }
  .sideways-A{
    grid-row: 1/3;
    grid-column: 1/3;  
  }
  .preview-container {
    width: 50%;
    margin: 0;
    z-index: 1;
  }

  .sideways-B{
    grid-row: 3/4;
    grid-column: 1/2;
  }
  .finish-explain{
    display: none;
  }
  .actions{
    margin-top: 7.5px;
  }

  .sideways-C{
    grid-row: 1/2;
    grid-column: 2/3;
  }
  #tab-container{
    font-size: 0.75rem;
    margin: 0;
  }

  .sideways-D{
    grid-row: 2/4;
    grid-column: 2/3;
  }
  .frame-option{
    width:75px;
    height:75px;
  }
  .tool-explain{
    font-size: 1rem;
  }


  span { font-size: 1.3rem; }
  button {
    font-size: 0.85rem;
    padding: 6.5px 12.5px;
  }
}

@media (min-width: 1024px) {
  #title {
     font-size: 2rem; 
  }
  .container {
    padding: 30px;
    max-width: 900px;
  }
  .tool-container{
    /*height: 22vh;*/
  }
  .finish-container{
    margin: 10px;
  }
  button{
    width: 155px;
  }

  p{
    font-size: 1.4rem;
  }
  span{
    font-size: 1.4rem;
  }

  #fontSizer label{
    font-size: 1.5rem;
  }

  .preview-container {
    margin: auto;
    width: 65%;
  }
  .actions button{
    font-size:1.6rem;
  }
  #tab-container ul {
    margin: 10px;
  }
  #tab-container ul li{
    font-size:1.6rem;
    padding: 12px 24px;
    border-radius: 10px;
  }
  .frame-option {
    width: 120px;
    height: 120px;
  }
  .info-btn{
    font-size: 1.6rem;
  }
  #howto{
    position: fixed;
    top: 0;
    left: 0;
    
    width: 100%;
    height: 100vh;
    
    background-color: rgba(0, 0, 0, 0.5);
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    z-index: 9999;
  }
  .howto-contents{
    background-color: rgba(255, 255, 255, 1);
    color: #444444;
    padding: 20px;
    border-radius: 8px;
    font-size: 1.8rem;
  }
  .howto-contents h3{
    text-align: center;
    margin: 2%;
  }
  .howto-contents h4{
    margin: 4% 0%;
  }
  .howto-contents h5{
    font-size: 1.6rem;
    margin: 1.5% 0%;
  }
  .upload-mes{
    font-size: 1.5rem;
  }
  .finish-explain{
    font-size: 1.5rem;
  }
  #credit{
    font-size: 1.5rem;
  }
  #credit span{
    font-size: 1.5rem;
  }
  #credit h2{
    margin: 3% 0%;
  }
  #credit h3{
    margin: 3% 0%;
  }
  #howtoBtn{
    width: 140px; height: 140px;
    bottom: 3%;
    right: 2.5%;
    background-image: radial-gradient(circle, var(--primary-color) 60%, transparent 61%);
  }
  #howtoCloseBtn{
    justify-content: center;
    width: 100px;
  }
  .finish-explain{
    margin-top: 30px;
  }
}

@media (min-width: 1024px) and (min-height: 800px) {
  .container {
    padding: 30px;
    max-width: 900px;
  }

  h1 {
    font-size: 2rem;
    margin: 20px;
  }

  button{
    width: 155px;
  }

  p{
    font-size: 1.5rem;
  }
  span{
    font-size: 2rem;
  }

  #fontSizer label{
    font-size: 1.5rem;
  }

  .preview-container {
    margin: auto;
    width: 75%;
  }
  .actions button{
    font-size:1.6rem;
  }
  #tab-container ul {
    margin: 10px;
  }
  #tab-container ul li{
    font-size:1.6rem;
    padding: 12px 24px;
    border-radius: 10px;
  }
  .info-btn{
    font-size: 1.6rem;
  }
  #howtoBtn{
    width: 140px; height: 140px;
    bottom: 3%;
    right: 2.5%;
    background-image: radial-gradient(circle, var(--primary-color) 60%, transparent 61%);
  }
  #howto{
    position: fixed;
    top: 0;
    left: 0;
    
    width: 100%;
    height: 100vh;
    
    background-color: rgba(0, 0, 0, 0.5);
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    z-index: 9999;
  }
  .howto-contents{
    background-color: rgba(255, 255, 255, 1);
    color: #444444;
    padding: 20px;
    border-radius: 8px;
    font-size: 1.8rem;
  }
  .howto-contents h3{
    text-align: center;
    margin: 2%;
  }
  .howto-contents h4{
    margin: 4% 0%;
  }
  .howto-contents h5{
    font-size: 1.6rem;
    margin: 1.5% 0%;
  }
  #howtoBtn{
    bottom: 3%;
    right: 2.5%;
    background-image: radial-gradient(circle, var(--primary-color) 70%, transparent 71%);
  }
  #howtoCloseBtn{
    justify-content: center;
    width: 100px;
  }
  .upload-mes{
    font-size: 1.5rem;
  }
  .finish-explain{
    font-size: 1.5rem;
  }
  #credit{
    font-size: 1.5rem;
  }
  #credit span{
    font-size: 1.5rem;
  }
  #credit h2{
    margin: 3% 0%;
  }
  #credit h3{
    margin: 3% 0%;
  }
}
