body { text-align: center; margin: 0; } .tic-tac-toe { font-family: 'Open Sans', sans-serif; height: 440px; width: 440px; margin: 50px auto 30px auto; position: relative; } .tic-tac-toe .grid { background-color: grey; position: absolute; display: block; border-radius: 3px; } .tic-tac-toe .horizontal-bar-1 { top: 140px; bottom: 290px; height: 10px; width: 440px } .tic-tac-toe .horizontal-bar-2 { top: 290px; bottom: 140px; height: 10px; width: 440px } .tic-tac-toe .vertical-bar-1 { left: 140px; right: 290px; height: 440px; width: 10px; } .tic-tac-toe .vertical-bar-2 { left: 290px; right: 140px; height: 440px; width: 10px; } .tic-tac-toe label { height: 140px; width: 140px; display: none; opacity: 0.0; position: absolute; cursor: pointer; -moz-transition: background-color 0.3s; -o-transition: background-color 0.3s; -webkit-transition: background-color 0.3s; transition: background-color 0.3s; } .tic-tac-toe label:hover { opacity: 0.2; } .circle { position: absolute; height: 100px; width: 100px; margin: 10px; border: 10px solid #dc685a; border-radius: 50%; } .cross { position: absolute; width: 140px; height: 140px; display: block; transform:rotate(45deg); -ms-transform:rotate(45deg); -webkit-transform:rotate(45deg); } .cross:before, .cross:after { content: ""; position: absolute; background: #78bec5; border-radius: 3px; } .cross:before { top: 65px; bottom: 65px; left: 0px; right: 0px; height: 10px; width: 140px; } .cross:after { left: 65px; right: 65px; height: 140px; width: 10px; } .tic-tac-toe input.col-0 + label { left: 0px; right: 300px; } .tic-tac-toe input.col-1 + label { left: 150px; right: 150px; } .tic-tac-toe input.col-2 + label { left: 300px; right: 0px; } .tic-tac-toe input.row-0 + label { top: 0px; bottom: 300px; } .tic-tac-toe input.row-1 + label { top: 150px; bottom: 150px; } .tic-tac-toe input.row-2 + label { top: 300px; bottom: 0px; } .tic-tac-toe input { display: none; } .tic-tac-toe input.turn-0 + label { z-index: 0; display: block; } {% for turn in turns_player %} .tic-tac-toe input.turn-{{turn}}:checked + label { cursor: default; opacity: 1.0; z-index: 10 !important; } .tic-tac-toe input.turn-{{turn}}:checked ~ .turn-{{turn + 2}} + label { z-index: {{turn + 2}}; display: block; } {% endfor %} {% for m in moves %} .tic-tac-toe {% for p in m.ps %}input.turn-{{p.t}}.field-{{p.i}}:checked ~ {% endfor %} input.turn-{{m.n.t}}.field-{{m.n.i}} + label { display: block; cursor: default; opacity: 1.0; z-index: 10 !important; } {% endfor %} .tic-tac-toe .end { width: 440px; height: 440px; padding-top: 125px; position: absolute; display: none; background-color: #ecaf4f; color: #3d4250; text-align: center; z-index: 11; background: rgba(255, 255, 255, 0.8); border-radius: 3px; } .tic-tac-toe .end h1 { margin: 40px; } .tic-tac-toe .end a { background-color: #3d4250; border-radius: 3px; text-decoration: none; color: #fff; padding: 10px; } {% for m in wins2 %} .tic-tac-toe {% for p in m.ps %}input.turn-{{p.t}}.field-{{p.i}}:checked ~ {% endfor %} .end { display: block; z-index: 10 !important; } .tic-tac-toe {% for p in m.ps %}input.turn-{{p.t}}.field-{{p.i}}:checked ~ {% endfor %} .end > h1:before { content: "Bot wins!" !important; } {% endfor %} {% for m in draws %} .tic-tac-toe {% for p in m.ps %}input.turn-{{p.t}}.field-{{p.i}}:checked ~ {% endfor %} .end { display: block; z-index: 10 !important; } .tic-tac-toe {% for p in m.ps %}input.turn-{{p.t}}.field-{{p.i}}:checked ~ {% endfor %} .end > h1:before { content: "Tied!" !important; } {% endfor %}